MicroPython on ESP32 with SPIRAM support

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

Re: MicroPython on ESP32 with SPIRAM support

Post by loboris » Fri Feb 16, 2018 9:33 am

pythoncoder wrote:
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?
I'm not shure what do you mean by "root message" ?!
There is only one help system, the Wiki.
If you mean the README.md in the base repository directory, there is a link to the Wiki:
Wiki pages with detailed documentation specific to this MicroPython port are available.

According to your post, you can access spiram, but only 512 KB. Have you set the larger value in menuconfig (Micropython --> System settings --> Micropython heap size) before build ?

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 » Sat Feb 17, 2018 7:11 am

Thank you, the heap size option fixed it. So much RAM :!: :D
Peter Hinch
Index to my micropython libraries.

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

Re: MicroPython on ESP32 with SPIRAM support

Post by tuupola » Sat Feb 17, 2018 7:12 am

pythoncoder wrote:
Sat Feb 17, 2018 7:11 am
Thank you, the heap size option fixed it. So much RAM :!: :D
I hope we get this also in vanilla MicroPython :)

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 » Sat Feb 17, 2018 7:38 am

Are there any commercially available boards with a supported (ideally STM) processor and SPIRAM?
Peter Hinch
Index to my micropython libraries.

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

Re: MicroPython on ESP32 with SPIRAM support

Post by loboris » Sat Feb 17, 2018 8:03 am

pythoncoder wrote:
Sat Feb 17, 2018 7:38 am
Are there any commercially available boards with a supported (ideally STM) processor and SPIRAM?
I think the question should be: Are there MPy supported processors supporting SPIRAM. SPIRAM support is the processor feature.

BTW, some STM32 processors (STM32F439, STM32F407ZET6, ...) supports external SRAM, but there is no driver in MicroPython to use it for heap (it is possible to make one, but it looks nobody is interested) .

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 » Sun Feb 18, 2018 12:00 pm

Good point! I wonder what is the answer to that question.

Another query: is there a way programmatically to determine if code is running on your port? The usual sys strings don't seem helpful in this regard. I'm trying to write a portable driver and there is a minor difference in I2C initialisation between the standard port and yours.
Peter Hinch
Index to my micropython libraries.

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

RTC class issue. Uasyncio. Hall sensor.

Post by pythoncoder » Sun Feb 18, 2018 1:32 pm

There is an issue with rtc.ntp_sync() in that there seems to be no way to ensure that it makes one attempt only to sync. Regular synchronisation is problematic for any program which uses utime.ticks_xx() functions for timing, as a resync causes sudden jumps in their value. This would cattle uasyncio timing. Such programs need to keep attempting a sync until achieved, and then run with the RTC free-running.

Perhaps a None value for update_period? Or perhaps there is a better way to avoid these sudden jumps.

uasyncio works fine except for the timeout and task cancellation features. These rely on recent upstream changes which will doubtless percolate through in due course.

A comment on the chip rather than the firmware: if anyone is thinking of using the Hall sensor it needs a remarkably strong magnet. Fridge magnets don't touch it ;)
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 » Sun Feb 18, 2018 4:58 pm

I tried the hall sensor and it was not very sensitive. Even a current sensor like the ACS712 was more responsive.

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

Re: MicroPython on ESP32 with SPIRAM support

Post by tuupola » Sun Feb 18, 2018 5:42 pm

pythoncoder wrote:
Sun Feb 18, 2018 12:00 pm
I'm trying to write a portable driver and there is a minor difference in I2C initialisation between the standard port and yours.
What is the difference?

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 » Mon Feb 19, 2018 6:57 am

My existing driver uses soft I2C which is not supported here

Code: Select all

# Standard port
i2c = I2C(-1, scl=scl_pin, sda=sda_pin)
# Loboris port doesn't support soft I2C
i2c = I2C(scl=scl_pin, sda=sda_pin)
A programmatic means of determining the port would be generally useful as there are inevitable differences.
Peter Hinch
Index to my micropython libraries.

Post Reply