How to allocate more memory for the Framebuffer - STM32H7

Description

So I’ve been dealing with this issue for awhile now and need some serious guidance on how to resolve it. I’m currently running LVGL on a Alientek Dev board utilizing an STM32H7 to drive a 1020x600 px display but cannot allocate enough memory to create an array large enough to actually fill the entire screen. At best I can render maybe 1020x200px which does indeed display the LVGL demo I have running, so LVGL’s APIs appear to be working as expected.

What MCU/Processor/Board and compiler are you using?

STM32H7 with the most recent version of LVGL.

What do you want to achieve?

LVGL is indeed running and working, I just need direction on how to properly allocate memory and or write/update the flash so I can utilize an array large enough to actually fill the entire screen.

What have you tried so far?

Using a secondary array allocated to a separate memory address to write. This sort of worked but I was getting an issue with the alpha were I couldn’t contain the layer to a set section of the screen so the layer behind it wasn’t visible unless I set the alpha way down which makes the image dark and difficult to read.

Attempting to setup DMA and use the SDRAM I know is one the board, configuring the FMC did not work. I also confirmed that the hardware is consistent as it matches the pinout provided in my documentation.

Code to reproduce

This is all I am currently doing to update the image.

 *(__IO uint16_t*) (hltdc.LayerCfg[0].FBStartAdress + (2*(Ypos*1040 + Xpos))) = (uint16_t)RGB_Code;
******************************************************************************
 * @attention
 *
 * <h2><center>&copy; Copyright (c) 2020 STMicroelectronics.
 * All rights reserved.</center></h2>
 *
 * This software component is licensed by ST under BSD 3-Clause license,
 * the "License"; You may not use this file except in compliance with the
 * License. You may obtain a copy of the License at:
 *                        opensource.org/licenses/BSD-3-Clause
 *
 ******************************************************************************
 */

/* Entry Point */
ENTRY(Reset_Handler)

/* Highest address of the user mode stack */
_estack = ORIGIN(RAM_D1) + LENGTH(RAM_D1);	/* end of "RAM_D1" Ram type memory */

_Min_Heap_Size = 0x200 ;	/* required amount of heap  */
_Min_Stack_Size = 0x400 ;	/* required amount of stack */


/* Memories definition */
MEMORY
{
  DTCMRAM    (xrw)    : ORIGIN = 0x20000000,   LENGTH = 128K
  ITCMRAM    (xrw)    : ORIGIN = 0x00000000,   LENGTH = 64K
  RAM_D1     (xrw)    : ORIGIN = 0x24000000,   LENGTH = 512K
  RAM_D2     (xrw)    : ORIGIN = 0x30000000,   LENGTH = 288K
  RAM_D3     (xrw)    : ORIGIN = 0x38000000,   LENGTH = 64K
  FLASH      (rx)     : ORIGIN = 0x08000000,   LENGTH = 1408K
  DATA       (xrw)    : ORIGIN = 0x080E0000,   LENGTH = 640K
}
```c

1020x600x2bpp means you have no choice but to use SDRAM, as that requires 1.2MB for a framebuffer. Are you using the BSP drivers ST provides?

Not that I’m aware of. I’m not even sure which functions to start with in that regard.

I’ve configured FMC through the CubdeIDE and then created a memory region starting at 0xC0000000 where I attempted to write the framebuffer to but that did not work. I’m very lost in terms of how to actually get SDRAM working/implemented as their is not a ton of resources for it so you can assume I’m starting with nothing.

I have a STM32H743 board from waveshare. They provide some code for setting up the SDRAM.
It’s under BSP_SDRAM_Init. I would suppose that Alientek provides some equivalent examples.

I have setup the SDRAM on address 0xd0000000. I think that depends on configuration in SDRAM init function.

When the FMC is properly setup for SDRAM you have to configure (adjust) the LTCD (MX_LTDC_Init or something like that).

And at last, adjust the flush function to write the lvgl created data to your new frame buffer (in SDRAM).

Thanks for the suggestion I’ll have a look.