Library 14- Working with SDRAM on STM32F429 Discovery

STM32F429 Discovery board has external 64Mbits or 8MBytes SDRAM chip ISSI IS42S16400.

STM32F429 has a FMC (Flexible Memory Control) peripheral to driving external SDRAM with hardware. FMC hardware is able to store up to 32bits variables at same time.

External SDRAM capatibilities
Variable size Max value Max address Max variables stored
8bit 0xFF 0x7FFFFF 8388608
16bit 0xFFFF 0x7FFFFE 4194304
32bit 0xFFFFFFFF 0x7FFFFC 2097152

Note: This library does not work on STM32F4 Discovery, because this MCU does not have FMC peripheral.

8MByte is a lot for that microcontroller, but can be very useful if you are working with LCD (storing images, …) which can increase LCD’s refresh rate.

In Standard Peripheral libraries pack is also included FMC example for SDRAM. I modified settings for our board and make a simple library.

SDRAM library


  • Operates with external 64Mb SDRAM
  • Functions to read/write 8, 16 or 32bit variable at a time
  • Version 1.1 – November 23, 2014
    • Functions for read/write are now defined as macros. This allows you to increase speed performance because you don’t need to call functions and put data to the stack
  • Supports STM32F429-Discovery or STM324x9-EVAL boards


    • STM32F4xx
    • STM32F4xx RCC
    • STM32F4xx GPIO
    • STM32F4xx FMC
  • TM
    • TM GPIO
    • defines.h
    • attributes.h

STM324x9-EVAL support

By default, library is designed for low cost STM32F429-Discovery board. If you want to use this library on STM324x9-EVAL board, open defines.h file and add define:


As always, here is the same. First we have to initialize SDRAM library. This is done with

Function returns 1 if sdram was properly initialized, to check this, function just simple write data to SDRAM’s location and read it back. If they are the same, everything is OK.

Write operation

For writing data to SDRAM I made 3 functions.

Read operation


Project available on Github, download library below.


Owner of this site. Application engineer, currently employed by STMicroelectronics. Exploring latest technologies and owner of different libraries posted on Github.

You may also like...

Read before commenting!

Before you make a new comment, make sure you agree with things listed below:

  • - Read post to make sure if it is already posted what you are asking for,
  • - Make sure you have the latest version of libraries used in your project,
  • - Make a clean and grammatically correct written message,
  • - Report as many details as possible, including what have you done so far,
  • - Do NOT post any code here. Use Pastebin,
  • - Do NOT post any error codes here. Use Pastebin,
  • - Specify STM32Fxxx family and used Discovery/EVAL/Nucleo or custom made board,
  • - Make sure your clock is set correct for PLL,
  • - If you are using my HAL drivers, please check this post how to start.
Comment will be deleted on breaking these rules without notification!