Hi,
For days, I have been trying to write my variables into the SDRAM mounted on the STM32F429 discovery board, but unfortunately no success came out of that. I am currently using STM32CubeMX to generate the initialization code for FMC. For writing to the SDRAM, I used the stm32f4xx_hal_sdram driver, but unfortunately using the write function “HAL_SDRAM_Write_8b(…)” writes the variables in the internal RAM; no matter what is the address given to the argument of this function. I also tried to define the external SDRAM (with the start address 0xD0000000 and length of 0x800000) in the "Options for targets" under the target tab. Every time that the checkbox related to RAM1 is ticked in the "Read/Write Memory Areas" section in the "Options for targets", my microcontroller does not run the code!!! Even a single LED can't be turned on or off. Does it have something to do with Keil?! Do I need to configure something else in Keil? Or does something need to be changed in the scatter file?
I would be grateful if you could help me with this. Thanks in advanced, Omid
Hey guys, I forgot to edit the message title :( The question is in fact How to declare variables into the SDRAM mounted on STM32F429i discovery board? . This discovery kit features a STM32F429ZIT6 MCU and a 64-Mbit SDRAM (part no. IS4xS16400J).
Thanks again, Omid
The SDRAM can't be the primary memory, especially for things like the stack.
The SDRAM (pins, controller, memory) needs to be initialized before use, this is typically done in the SystemInit() routine, and before the run time code in __main unpacks the statics.
You can define regions within the Target GUI or Scatter File, and direct variables via pragma, attribute directives, or at an object file level via the the scatter file.
Sorry if this is considered off topic, but we could use a first stage bootloader to initialise the SDRAM before switching across to the main application which could then use SDRAM as primary.
You could, same with other external memory, where the interface must be brought up, and board specific. The issue here really being out of reset, everything other than the internal SRAM, FLASH, ROM is inaccessible. And the initial SP described in the vector table needs to be in viable memory.
On the F429 specifically the SDRAM is tragically slow, so putting the STACK in there will impact all code execution negatively. Consider using the CCM RAM
Westonsupermare Pier,
No thanks button on this rather outdated forum. So I'll say 'cheers' here :)
View all questions in Keil forum