Skip to main content
Version: 4.16

5. Framebuffer in external RAM


In this step we will move the framebuffer from internal to external RAM, and make sure that the framebuffer can still be transferred to the display.

Skip this step if external RAM is not relevant for your board bring up.

This step will stress test the external RAM since the display controller has certain expectations on the transfer speed. This might result in errors. Common errors are LTDC underrun, because the bandwidth of the external RAM is not high enough, or pixel errors because the RAM is configured incorrectly and is running "out of spec".


The goal in this step is to remove the framebuffer array from internal RAM and use a framebuffer in external RAM.


Here are the verification points for this section. These are similar to the verification points when the framebuffer is in internal RAM, but should be checked again, as the speed on the external memory may influence the transmission of the framebuffer to the display.

Verification PointRationale
Framebuffer is shownDisplay controller or SPI is configured and running
Updated framebuffer is shownWe know how to repeatedly transmit the framebuffer
Framerate is correctThe pixel clock and porches are configured to get the required framerate


The following are the prerequisites for this step:

  • Address of the framebuffer in the external RAM


We have these two tasks:

  • Place the framebuffer in external RAM
  • Setup the display controller to read from the external RAM

When the frambuffer is in external RAM, it is common practice to not allocate an array for it. You just declare a pointer to the correct address. The address in external RAM is then manually selected. It can be anywhere in the external RAM, but the start of the RAM is commonly used:

uint16_t* framebuffer = (uint16_t*)0xC0000000; //16 bpp framebuffer

You can reuse the small test programs you created in the steps in Display Internal.

LTDC Layer configuration#

Remember to change the configuration of the LTDC Layer. Since we now have a specific address for the framebuffer, we can insert that address in CubeMX (Color Frame Buffer Start Address):

Configuring LTDC Layer Parameters

Remember to remove this line from your program and the framebuffer array:

HAL_LTDC_SetAddress(&hltdc, framebuffer, LTDC_LAYER_1);

If the LTDC Layer size was setup to only update a part of the display in step 03 (due to the amount of internal RAM), now is the time to redo that. Reconfigure the LTDC Layer such that the entire display is covered.