Portenta H7 - SDRAM Configutration

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


  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()}")

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).


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.


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.