I'm writing a crude memory diagnostic for SDRAM (just to see if I can). The code accesses SDRAM using a pointer.
__IO uint32_t * SDRAM_ptr;
SDRAM_ptr = (__IO uint32_t *)0xC0000000;
Using this pointer in a loop, I can write and read the first 2 megabytes reliably, but more than 2 megabytes causes the program to hang (sits and does nothing after the SDRAM read starts). I assumed that the program would fail beyond 0xC0800000, but its failing when beyond 0xC0200000.
The LCD display is not enabled.
CPU clock is set to 200 MHz.
Initialization was done with HAL and BSP functions.
Another curious behavior is that if I set the diagnostic to test 2 megabytes (0x00200000), I can set SDRAM_ptr to any of 0xC0000000, 0xC0000004 and 0xC0000008 as a starting point and the diagnostic works meaning that at least 8 bytes beyond 0xC0200000 seem to be accessible. If I set to 0xC0000010, it fails. The program writes data values starting at 0x00000000 and incrementing by 4 for each uint32_t location. Yet if I set the length of SDRAM to test to 0x00200004, it fails.
Any clues about what I'm doing wrong?