Free RAM on MicroPython boards

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
User avatar
rcolistete
Posts: 352
Joined: Thu Dec 31, 2015 3:12 pm
Location: Brazil
Contact:

Re: Free RAM on MicroPython boards

Post by rcolistete » Sat Nov 12, 2016 5:40 pm

rcolistete wrote:
Roberthh wrote:Today's commit for ESP8266 increased the heap and this the available RAM by 8k.
Thanks. Hope to see it in v1.8.6. Constrained RAM is one of the limitations of ESP8266, so this increase will be very useful.
Tested today MicroPython v1.8.6-7 on ESP8266, after soft reset we have 29312 bytes (versus 20000 bytes in v1.8.5-10) with WebREPL not enabled :

Code: Select all

>>> import gc
>>> gc.collect()
>>> gc.mem_free()
29312
Or 27568 bytes with WebREPL enabled.

Bravo, MicroPython ESP8266 developers !

Updated 1st post.
My "MicroPython Samples". My "MicroPython Firmwares" with many options (double precision, ulab, etc).

User avatar
bmarkus
Posts: 111
Joined: Tue Oct 21, 2014 5:58 am

Re: Free RAM on MicroPython boards

Post by bmarkus » Sun Dec 18, 2016 2:22 pm

With the new LoPy 1.0.0.b1 fw free RAM is reduced again, now it is 51k only
Tiny Core Linux (piCore) developer
HAM radio call: HA5DI (Béla)

User avatar
bmarkus
Posts: 111
Joined: Tue Oct 21, 2014 5:58 am

Re: Free RAM on MicroPython boards

Post by bmarkus » Fri Jan 06, 2017 7:45 am

LoPy 1.2.0b1 firmware introduced new features, which is great. And as usual, free RAM reduced again, now it is 26k. There are many promised but not yet implemented features. Curious, whether RAM will go away totally before finalizing firmware or there will be 1-2K left for everything else.
Tiny Core Linux (piCore) developer
HAM radio call: HA5DI (Béla)

User avatar
rcolistete
Posts: 352
Joined: Thu Dec 31, 2015 3:12 pm
Location: Brazil
Contact:

Re: Free RAM on MicroPython boards

Post by rcolistete » Sat Feb 09, 2019 4:29 pm

What is the current maximum free RAM on MicroPython new boards, like :
- ESP32 4MB PSRAM on official firmware and Loboris firmware ?
- ESP32 8MB PSRAM ?
- OpenMV Cam H7 ?
- Sipeed MAix BiT (with Kendryte K210) ?

Updated 1st post with Pyboard D free RAM.

Edit : MicroPython from Loboris shows 3046 KB of free RAM on Kendryte K210.
My "MicroPython Samples". My "MicroPython Firmwares" with many options (double precision, ulab, etc).

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

Re: Free RAM on MicroPython boards

Post by Roberthh » Sat Feb 09, 2019 8:36 pm

Free RAM:
ESP32 micropython.org, with 4 MB SPIRAM: 4089744
ESP32 micropython.org, without SPIRAM: 118304
WIPY3, 4 MB SPIRAM: 2552736
WIPY2. no SPIRAM: 49280
K210, MaixPY firmware: ~2048 kB free
Teensy 3.6: 234272

So with any device with SPIRAM there is plenty of RAM available. Devices w/o SPIRAM are typically more responsive

User avatar
rcolistete
Posts: 352
Joined: Thu Dec 31, 2015 3:12 pm
Location: Brazil
Contact:

Re: Free RAM on MicroPython boards

Post by rcolistete » Sun Feb 10, 2019 12:58 am

Roberthh, I've just tested an ESP32 with 4MB SPRAM :

Code: Select all

MicroPython v1.10 on 2019-01-25; ESP32 module with ESP32
Type "help()" for more information.
>>> import gc
>>> gc.collect()
>>> gc.mem_free()
2811792
which is 2745.9 KB of free RAM.
So, which firmware have you used to obtain 4089744 bytes (3993.9 KB) of free RAM ?

Are the ESP32 MicroPython firmwares ready for ESP32 with 8MB of SPRAM ?

About the MaiX (K210), could be possible to have more than just 2-3 MB of free RAM from the 6-8MB of total SRAM ?
My "MicroPython Samples". My "MicroPython Firmwares" with many options (double precision, ulab, etc).

User avatar
mattyt
Posts: 410
Joined: Mon Jan 23, 2017 6:39 am

Re: Free RAM on MicroPython boards

Post by mattyt » Sun Feb 10, 2019 1:35 am

Recent (post 1.10) ESP32 daily builds have updated to the latest ESP-IDF. This has allowed a couple of useful improvements, most notably that the full 4MB of PSRAM is now available and, on boards without PSRAM, there is more (16-20KB - I need to measure exactly) regular RAM available too. Damien did all this work less than two weeks ago.

As for the 8MB RAM it's not clear to me how this is going to be utilised for MicroPython. As I understand it, the ESP32 can only address 4MB. I believe that the IDF provides a feature intended to allow switching between banks of 4MB RAM pages if the PSRAM allows it (ie if it's an 8MB chip). But that won't be particularly useful to MicroPython unless there's a large overhaul - can't switch out a page without losing the whole heap...

It would be useful for a data acquisition device where the software could be stored in regular RAM and the PSRAM banks can be used to store data. I suppose this would be possible with MicroPython but will add a fair amount complexity...I'd be curious to know if anyone would have such a use for this?

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

Re: Free RAM on MicroPython boards

Post by loboris » Sun Feb 10, 2019 10:00 am

mattyt wrote:
Sun Feb 10, 2019 1:35 am
As for the 8MB RAM it's not clear to me how this is going to be utilised for MicroPython.
Upper 4MB cannot be used for MicroPython heap. It can be used for storing data or for RAM file system, I'm working on a driver for it. It will enable very fast writing speeds (practicaly the same as read speed). Read speed from psRAM is same or lower than from Flash, depending on configuration).
rcolistete wrote:
Sun Feb 10, 2019 12:58 am
So, which firmware have you used to obtain 4089744 bytes (3993.9 KB) of free RAM ?
...
About the MaiX (K210), could be possible to have more than just 2-3 MB of free RAM from the 6-8MB of total SRAM ?
On ESP32, the size of the MicroPython heap can be configured on compile time.

On K210, the size of the MicroPython heap can be configured on compile time. As K210 executes the firmware from RAM (it is copied from Flash on boot) and some amount of RAM has to be reserved for internal stacks and heaps, the practical limit for MicroPython heap is ~6 MB.

Post Reply