HAL library 11- SDRAM for STM32Fxxx

SDRAM library was designed to be used on STM32F429-Discovery, STM32F439-EVAL and STM32F7-Discovery boards. With single define, library will know which board is used and which settings should use to get proper working for RAM.

FMC peripheral is used for driving SDRAM.


Read more about new HAL libraries


  • Use SDRAM on STM32F429-Discovery board
  • Use SDRAM on STM32F439-EVAL board
  • Use SDRAM on STM32F7-Discovery board
  • Supports custom pins initialization in case user has own board with RAM
  • Supports commands for read and write different types of numbers


  • HAL
  • TM
    • STM32Fxxx HAL
    • defines.h
    • attributes.h
    • TM GPIO

Board pinouts

SDRAM pins are different for different board. Using proper defines (explained below) you can select which board is used.

For full pinout list, download and open SDRAM library and check header file with description.

Select board

The most important thing is to tell library, which board is used in target system. There are 2 possible ways to do that. One (and I prefer it) is to check my DISCO library and follow instructions which define you have to set for proper board, and another, explained below.

If you choose option one, then you will have no worries in my future libraries where library needs to know exactly which board is used!

The second option (I don’t prefer it) is, to set define only for this library. Copy define corresponding to your board into defines.h file or make a global defines in compiler’s settings. I made global defines in Keil uVision under “Options for Target” -> “C/C++” tab.

Functions and enumerations


Project is available in Github, download all libraries 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...