I've modified the SDK's example for SEMC to touch all 32MB of SDRAM, then call SEMC_Deinit() and BOARD_InitSEMC() again. This only works a few times before generating a hard fault after the call to Deinit, with the fault code reading IMPRECISERR, Imprecise Data Bus Error (0xe000ed28: 0x00000400). In order to reproduce the error, it seems that a large amount of RAM must be accessed (more than the ~1KB from the example) and the RAM must be deinitialized and reinitialized more than once. Is this the correct way to bring the SDRAM down and back up again? The eventual use case for this is to only use the SDRAM occasionally and to deinitialize between uses to save power.
for(i = 0; i < 10; i++)
{
SEMC_SDRAMReadWrite32Bit();SEMC_Deinit(SEMC);
if (BOARD_InitSEMC() != kStatus_Success)
{
PRINTF("\r\n SEMC SDRAM Init Failed\r\n");
}
}
Solved! Go to Solution.
Turns out that it was an issue with caching. Using SCB_InvalidateDCache_by_Addr() before the SEMC_Deinit call fixes the issue.
Turns out that it was an issue with caching. Using SCB_InvalidateDCache_by_Addr() before the SEMC_Deinit call fixes the issue.