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 :)
I have got a question here, that if I store data to SDRAM that process becomes slow? I wish to know that I want to store data sent via USB to SDRAM is it possible?
waiting for your reply regards Ark.
Well internal memory is fast, external memories are significantly slower, perhaps 4-6x slower in access times.
Stuff you want to actively work on should be as close to the processor core as possible.
The F429 doesn't have any caching for external memory, random access to SDRAM takes multiple cycles to select the memory address on the device. You'd need hardware to stream multiple sequential words to improve the efficiency.
how about using an external sd card instead of SDRAM whether that would fast in compare with SDRAM?
It would be slower, wouldn't it? Bus width is smaller, clock speed is slower. Think this stuff through logically.
In logical point of view, the bus width is 32bit and the clock speed is 168MHZ. is it slower? i don't get it.
"the bus width is 32bit and the clock speed is 168MHZ"
You asked if using an SD-Card would be slower.
So write down the corresponding figures - bus width and clock speed - for the SD card, and then think about which is going to be slower ...
It's not exactly rocket science ...