MicroPython on ESP32 with SPIRAM support

All ESP32 boards running MicroPython.
Target audience: MicroPython users with an ESP32 board.
loboris
Posts: 319
Joined: Fri Oct 02, 2015 6:19 pm

Re: MicroPython on ESP32 with SPIRAM support

Post by loboris » Thu Feb 01, 2018 12:16 pm

OutoftheBOTS_ wrote:
Thu Feb 01, 2018 11:57 am
Can I use 36 or 39 as SPI MISO ??
Can I use 36 or 39 as ADC input for the battery monitor??
I haven't tested it, but using pins 36 or 39 should be OK for SPI MISO.

You can use pins 36 & 39 for ADC input.
The only restriction is that if you are using the the internal hall sensor, the pins 36&39 cannot be used as regular ADC inputs.

OutoftheBOTS_
Posts: 781
Joined: Mon Nov 20, 2017 10:18 am

Re: MicroPython on ESP32 with SPIRAM support

Post by OutoftheBOTS_ » Thu Feb 01, 2018 9:01 pm

All my programs I use a try except to catch any errors or keyboard interrupt and in the except I deint everything like SPI, PWM but haven't found any docs for releasing machine.Pin and am just setting pin.value(0), is there a way to deinit Pin??

User avatar
pythoncoder
Posts: 4246
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: MicroPython on ESP32 with SPIRAM support

Post by pythoncoder » Fri Feb 02, 2018 5:48 am

Assuming this port hasn't done anything special the usual approach is to set pins to inputs so that they go high impedance.
Peter Hinch

OutoftheBOTS_
Posts: 781
Joined: Mon Nov 20, 2017 10:18 am

Re: MicroPython on ESP32 with SPIRAM support

Post by OutoftheBOTS_ » Fri Feb 02, 2018 6:41 am

@pythoncoder Thanks :)

I am at the stage of tuning my PID control system for individual motor speed then a higher level PID to sync the 2 motors so the robot will drive straight instead of waddle like a duck.

ATM I am trying to tune by just printing the error to the screen with very ordinary results. I really need to be able to graph the error to tune much better. I though maybe just to save all the error data to a file on the ESP32 then upload to my PC then load it into excel and ask it to graph it but was wondering can anyone think of a easy way to graph it live on my PC ?? I am using a timer to read the encoders and calualte the error every 100ms and adjust the duty cycle.

User avatar
pythoncoder
Posts: 4246
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: MicroPython on ESP32 with SPIRAM support

Post by pythoncoder » Fri Feb 02, 2018 6:54 am

I think you'd get more eyes on a generic query like this if you raised it as a new topic. Not everyone is using the Loboris port. And this query is not relevant to it.

My general approach would be to use a socket for communication. The PC program would read data from the socket and plot it (possibly using asyncio). But I'm not well-versed in CPython plot modules.
Peter Hinch

OutoftheBOTS_
Posts: 781
Joined: Mon Nov 20, 2017 10:18 am

Re: MicroPython on ESP32 with SPIRAM support

Post by OutoftheBOTS_ » Fri Feb 02, 2018 10:33 pm

@pythoncoder

Thanks for your suggestion. After googling it seems running a web-server on the ESP32 with websockets running a java script plotter client side will do the job nicely and the websockets will also allow me to make live changes to my PID gain on the ESP32.

It is going to be an interesting learning curve as I have never used sockets before, let the fun begin :)

kevinkk525
Posts: 733
Joined: Sat Feb 03, 2018 7:02 pm

Re: MicroPython on ESP32 with SPIRAM support

Post by kevinkk525 » Sat Feb 03, 2018 7:06 pm

Has someone encountered an error like this before? I had nothing running except ftp server with one connected client. when I came back 3 hours later this error was seen:

Guru Meditation Error: Core 0 panic'ed (LoadProhibited)
. Exception was unhandled.
Core 0 register dump:
PC : 0x40132171 PS : 0x00060730 A0 : 0x80130b14 A1 : 0x3ffe1a20
A2 : 0x3ffe2970 A3 : 0x3ffe1a60 A4 : 0x00060720 A5 : 0x00000001
A6 : 0x00060723 A7 : 0x3ffdfce5 A8 : 0xcfffffd3 A9 : 0x00000000
A10 : 0x1100c9c9 A11 : 0x00000002 A12 : 0x00000050 A13 : 0x03333333
A14 : 0x00000000 A15 : 0x00000000 SAR : 0x0000000a EXCCAUSE: 0x0000001c
EXCVADDR: 0x1100ca31 LBEG : 0x4009e018 LEND : 0x4009e046 LCOUNT : 0xffffffff

Backtrace: 0x40132171:0x3ffe1a20 0x40130b11:0x3ffe1a60 0x40130cb0:0x3ffe1b30 0x401378c1:0x3ffe1b60 0x400e07c3:0x3ffe1b80 0x400e146d:0x3ffe1ba0 0x400d8dde:0x3ffe1bd0

CPU halted.

User avatar
Roberthh
Posts: 2016
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: MicroPython on ESP32 with SPIRAM support

Post by Roberthh » Sat Feb 03, 2018 8:41 pm

Depends. I had occurrences like that with one of my boards, an Wemos ESP32 Pro with a WROVER module, SPI and RAM speed set to 80 MHz. At 40 MHz is was stable, and another unit is also stable at 80 MHz.

kevinkk525
Posts: 733
Joined: Sat Feb 03, 2018 7:02 pm

Re: MicroPython on ESP32 with SPIRAM support

Post by kevinkk525 » Sat Feb 03, 2018 8:57 pm

my Lolin ESP32 Pro Wrover runs at 40MHz SPI RAM speed.
Well let's hope this error won't happen again..

loboris
Posts: 319
Joined: Fri Oct 02, 2015 6:19 pm

Re: MicroPython on ESP32 with SPIRAM support

Post by loboris » Sat Feb 03, 2018 9:05 pm

kevinkk525 wrote:
Sat Feb 03, 2018 7:06 pm
Has someone encountered an error like this before? I had nothing running except ftp server with one connected client. when I came back 3 hours later this error was seen:

Guru Meditation Error: Core 0 panic'ed (LoadProhibited)
...
CPU halted.
Could you run this in esp-idf monitor (./BUILD.sh monitor). That way the functions wich caused the error and the location in the source files will be visible...

Post Reply