Is there a way to increase RAM?

The official pyboard running MicroPython.
This is the reference design and main target board for MicroPython.
You can buy one at the store.
Target audience: Users with a pyboard.
Post Reply
User avatar
Meekdai
Posts: 45
Joined: Mon Jan 29, 2018 12:45 pm

Is there a way to increase RAM?

Post by Meekdai » Mon Dec 03, 2018 6:34 am

Hello everyone.
I have a lot of chips controlled by my system (pybv10). I have packaged them into modules for each chip driver and frozen them.
I read the instructions for memory usage.http://docs.micropython.org/en/latest/r ... ained.html
After optimizing the code, the memory is still insufficient. Is there a solution for software or hardware?

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

Re: Is there a way to increase RAM?

Post by pythoncoder » Mon Dec 03, 2018 9:30 am

There is no way to do this in hardware. You may need to consider an alternative platform or wait for the Pyboard D series to emerge.
Peter Hinch
Index to my micropython libraries.

User avatar
Meekdai
Posts: 45
Joined: Mon Jan 29, 2018 12:45 pm

Re: Is there a way to increase RAM?

Post by Meekdai » Mon Dec 03, 2018 10:30 am

Why is the available gc memory only about 72KB?

Code: Select all

MicroPython v1.9.4-479-g828f771e3-dirty on 2018-11-30; PYBv1.0 with STM32F405RG
Type "help()" for more information.
>>> import micropython
>>> micropython.mem_info(1)
stack: 508 out of 15360
GC: total: 74368, used: 69968, free: 4400
I want to know how the 192KB+4KB RAM is allocated.
By the way, when will pyboard D be available? I am looking forward to it for a long time.

chuckbook
Posts: 135
Joined: Fri Oct 30, 2015 11:55 pm

Re: Is there a way to increase RAM?

Post by chuckbook » Mon Dec 03, 2018 11:55 am

There are 192kB of SRAM on the F405. A PYBV11 shows:

Code: Select all

>>> micropython.mem_info(1)
stack: 484 out of 15360
GC: total: 102656, used: 1440, free: 101216
64 kB SRAM is used for filesystem cache and ~30kB SRAM for static variables and stack (depending on build options).
Using 64k as file system cache is a pity but unfortunately unavoidable if you want to have a FAT file system in the internal flash.
The upcoming PYBD will use SRAM in a much more efficient way.

User avatar
Meekdai
Posts: 45
Joined: Mon Jan 29, 2018 12:45 pm

Re: Is there a way to increase RAM?

Post by Meekdai » Tue Dec 04, 2018 2:52 am

Is there a way to use the 64K that was originally used as a file system cache ? I can use the SD card to do file system storage.

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

Re: Is there a way to increase RAM?

Post by Roberthh » Tue Dec 04, 2018 6:25 am

Why does mem_info() on your device show only ~73k. The mem_info() on the device of @dhylands shows about 100k, the same as mine.

User avatar
Meekdai
Posts: 45
Joined: Mon Jan 29, 2018 12:45 pm

Re: Is there a way to increase RAM?

Post by Meekdai » Tue Dec 04, 2018 6:53 am

Because I used websocket on pyboard.

Code: Select all

#define MICROPY_PY_LWIP (1)
#define MICROPY_PY_WEBSOCKET (1)
Lwip maybe used part of the memory.

It seems to be a bit difficult to use CCM data RAM.
viewtopic.php?f=2&t=427&hilit=CCM+data+RAM

User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: Is there a way to increase RAM?

Post by dhylands » Tue Dec 04, 2018 5:14 pm

CCM memory on the pyboard is used/reserved by the filesystem for writing Flash blocks.

Post Reply