SDRAM reverting to 0x0000 for all locations when halting with debugger STM32F429
- May 30, 2021
- 1 reply
- 1352 views
Hi,
I've run into a problem that's a bit puzzling for me:
I'm trying to get SDRAM to work on my board. The Hardware is based on the STM32F429 Discovery-Board, but has the SDRAM connected to Bank 1, a NAND-Flash connected to Bank 2 and the ILI9341 LCD Connected only via SPI.
SDRAM initializes (no Crashes) and I can run this code:
#define SDRAM_BANK_ADDR 0xC0000000
#define SDRAM_SIZE 0x00800000
uint16_t sdram_check_buffer[(SDRAM_SIZE / 4)] __attribute__((section(".bigdata")));
uint32_t SDRAM_Check() {
uint16_t dataPattern = 0xAF56;
uint32_t error_number = 0;
for (int i = 0; i < (SDRAM_SIZE / 4); i++) {
*(__IO uint32_t*) (SDRAM_BANK_ADDR + i) = 0xFFFF;
}
HAL_Delay(10);
for(int i = 0; i < (SDRAM_SIZE / 4); i++){
sdram_check_buffer[i] = dataPattern;
}
HAL_Delay(10);
for (int i = 0; i < (SDRAM_SIZE / 4); i++){
if(sdram_check_buffer[i] != dataPattern)
{
error_number++;
}
}
return error_number;
}Now the problem: When I pause the application, I get tons of errors - basically every single location of the "sdram_check_buffer"-Array is bad. Looking at the memory-monitor, I see every location reverting to 0x0000.
Single stepping through the for-loops, I see all visible cells changing to the same value and then reverting back to 0 on the next step.
If I don't pause the execution of this piece of code, I get an error-count of 0. A breakpoint on "error_number++;" is also never triggered.
Is this normal behavior, or is there something wrong with the initialization of my Board?
For better understanding, I've attached the entire project as a Zip-File.
Hope someone can shed some light on this :)
