Loading...
 

System Workbench for STM32


TrueStudio and CubeMX external SDRAM setup

I have the STM32F746G Discovery board and used CubeMX to generate the TrueStudio project for this. Out of the box CubeMX already has a project for this board with all paripherals already setup, including external SDRAM. However the generated truestudio project does not appear to set the SDRAM fully to utilise it!

There are calls generated for MX_FMC_Init() which in turn calls the function HAL_SDRAM_Init() but when you debug there is no region appearing in the build analyzer. I have been reading that this must be defined in the .ld file so I have added it so it now looks like this:

MEMORY
{
RAM (xrw)  : ORIGIN = 0x20000000, LENGTH = 320K
FLASH (rx)  : ORIGIN = 0x08000000, LENGTH = 1024K
SDRAM (rx)  : ORIGIN = 0xC0000000, LENGTH = 16M
}

which now shows a region in the build analyzer called SDRAM but my write/reads to any address over 0xC0000000 are still failing and using the memory watch window it cannot show any memory in that region and just shows ????.

What am I missing? Any clues would be great.

Tunisia

Hi,

Before the IDE can read the SDRAM content, you should initialize it in memory mapped mode, so that the memory viewer could read and display its content.

another hint if you need to place some variables, constants within the SDRAM, you should use the section attribute when declaring your variable, and of course you need to create this section within the .ld file.

Regards,
Tarek