Hello all,
I have a Portenta H7 Board and I’ve installed the OpenMV micropython firmware via using the IDE.
I can use the flash memory withouth any problem but I think the OpenMV firmware is not able to handle with the 8MB SDRAM on board.
OpenMV development; MicroPython v1.19-omv-r6-1067-g3fde8fad8; PORTENTA-STM32H747
Here is what i see when I run the pyb.info() function:
import pyb
pyb.info()
Output:
ID=24002500:09513033:36343638
DEVID=0x0450
REVID=0x2003
S=400000000
H=200000000
P1=100000000
P2=100000000
_etext=81fe538
_sidata=81fe540
_sdata=30000000
_edata=3000085c
_sbss=30004000
_ebss=300170c4
_sstack=20000000
_estack=20010000
_ram_start=30000000
_heap_start=300170c4
_heap_end=3003f0c4
_ram_end=30040000
qstr:
n_pool=3
n_qstr=69
n_str_data_bytes=735
n_total_bytes=1807
GC:
160064 total
11920 : 148144
1=218 2=26 m=54
LFS free: 15575040 bytes
Also, I’ve use the gc library to understand how much RAM available on the board, please see the code and output below.
print(f"Allocated Memory: {gc.mem_alloc()} Free Memory: {gc.mem_free()}")
Output:
Allocated Memory: 5040 Free Memory: 155024
Am I missing something or there is a problem with the firmware?
We use the SDRAM for the frame buffer. Not the MicroPython heap. So, when you capture images they go into the 8 MB of SDRAM. There’s no methods that will print out this info for you in our firmware. That said, it’s all handled by our camera driver and image processing library and we use the memory to the fullest extent possible.
Hi @kwagyeman ,
Thank you for your quick reply.
I’m not using the camera, I only use the OpenMV micropython firmware couse it has all the data analysis libraries that I need on my project. (Numpy and tf)
Is it posible to use the SDRAM without using the camera features? I need the SDRAM to analyse quite big data (7 MB max).
Thanks
Potentially, you’ll probably want to edit our firmware and just move the MicroPython heap to the SDRAM. However, there’s going to be quite a few edits you have to make to make this happen. It’s not easy… and since this isn’t a use case for us you are on your own.
That said, we do allow you to allocate images in the sdram by default which you can then get raw access to the bytearray(). Then you can do whatever you want with that.
E.g.
import image, sensor
buffer = image.alloc_extra_fb(sensor.GRAYSCALE, 1000, 1000)
b = buffer.bytearray()
The above will give you a 1MB bytearray. You can have multiple allocs. It’s a stack interface, so, alloc and pop.