MicroPython on ESP32 with SPIRAM support

All ESP32 boards running MicroPython.
Target audience: MicroPython users with an ESP32 board.
User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: MicroPython on ESP32 with SPIRAM support

Post by pythoncoder » Thu Feb 15, 2018 11:10 am

505712
Peter Hinch
Index to my micropython libraries.

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

Re: MicroPython on ESP32 with SPIRAM support

Post by Roberthh » Thu Feb 15, 2018 11:37 am

did you try one of the pre-built images, like this one:
https://github.com/loboris/MicroPython_ ... sp32_psram

User avatar
tuupola
Posts: 54
Joined: Sun Sep 17, 2017 12:10 am
Contact:

Re: MicroPython on ESP32 with SPIRAM support

Post by tuupola » Thu Feb 15, 2018 11:39 am

loboris wrote:
Sun Feb 11, 2018 10:13 am
I2C module, which was based on Pycom code (GPL licensed), is now rewritten from scratch (by the way, it now includes i2c slave and some improvements) and is MIT licensed. The update will be commited later today.
Awesome! I was looking forward for the I2C slave. Is it also committed to GitHub? I could not find any source to figure out how it works.

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

Re: MicroPython on ESP32 with SPIRAM support

Post by pythoncoder » Thu Feb 15, 2018 12:30 pm

Roberthh wrote:
Thu Feb 15, 2018 11:37 am
did you try one of the pre-built images, like this one:
https://github.com/loboris/MicroPython_ ... sp32_psram
That works, thank you. I can connect with miniterm but connecting using rshell is difficult. It only connects if I reset the board then wait a few seconds (but not too long). I had no problems with the hand-built firmware.

I wonder if there is something amiss with the instructions in the root message (or if I missed something there). I did this:

In menuconfig select → Component config → ESP32-specific → Support for external, SPI-connected RAM
In menuconfig select → Component config → ESP32-specific → SPI RAM config → Make RAM allocatable using heap_caps_malloc
Peter Hinch
Index to my micropython libraries.

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

Re: MicroPython on ESP32 with SPIRAM support

Post by kevinkk525 » Thu Feb 15, 2018 1:57 pm

If you do not set the size in menuconfig you experience that.
I set the size in Micropython --> System settings --> Micropython heap size
to 3400 KB and that works fine.
Kevin Köck
Micropython Smarthome Firmware (with Home-Assistant integration): https://github.com/kevinkk525/pysmartnode

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

Re: MicroPython on ESP32 with SPIRAM support

Post by loboris » Thu Feb 15, 2018 4:05 pm

As @kevinkk525 mentioned, you have to set the heap size in menuconfig (Micropython --> System settings --> Micropython heap size), the defaul is 512KB if psRAM is used. You can set it up to 3584 KB, it is less than available 4096KB, as WiFi and some other drivers can also use psRAM.

@tuupola
The new I2C module is not yet commited, I had to do some more tests for I2C slave and write the documentation. It is now working quite good and will be commited probably tommorow.

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

Re: MicroPython on ESP32 with SPIRAM support

Post by loboris » Thu Feb 15, 2018 4:14 pm

pythoncoder wrote:
Thu Feb 15, 2018 10:38 am
One suggestion: why not put the pre-requisites into the otherwise excellent build instructions in the root message?
It is on Build Wiki.

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

Re: MicroPython on ESP32 with SPIRAM support

Post by kevinkk525 » Thu Feb 15, 2018 5:15 pm

loboris wrote:
Thu Feb 15, 2018 4:14 pm
pythoncoder wrote:
Thu Feb 15, 2018 10:38 am
One suggestion: why not put the pre-requisites into the otherwise excellent build instructions in the root message?
It is on Build Wiki.
The instructions for changing the heap size are not in the build wiki as far as I can tell.
Kevin Köck
Micropython Smarthome Firmware (with Home-Assistant integration): https://github.com/kevinkk525/pysmartnode

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

Re: MicroPython on ESP32 with SPIRAM support

Post by loboris » Thu Feb 15, 2018 6:09 pm

kevinkk525 wrote:
Thu Feb 15, 2018 5:15 pm
The instructions for changing the heap size are not in the build wiki as far as I can tell.
The Wiki page for all the configuration options will be added son...

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

Re: MicroPython on ESP32 with SPIRAM support

Post by pythoncoder » Fri Feb 16, 2018 7:02 am

@loboris Thanks for that. A pointer to the build wiki in the root message would help newcomers to your fork and also ensure you only have one doc to maintain.

I'm still foxed as to why I can only access SpiRAM using a pre-built firmware image. Are further config options required to set the heap size?
Peter Hinch
Index to my micropython libraries.

Post Reply