2020-12-02 07:56 AM
After the firmware is up and running, I am trying to put the SDRAM in self-refresh mode. We are using FreeRTOS. In order to put SDRAM into self-refresh mode, I write 0x4480D to FMC_SDCMR register. I am using IAR debugger, and I execute the statement HAL_SDRAM_SendCommand(&hsdram1, &command, SDRAM_TIMEOUT); manually from the debugger. This way, I assume SDRAM should be in idle state when I am issuing the self-refresh command. I am only issuing the command to bank 2 since we use only bank 2 in our design. After I write the value to FMC_SDCMR, FMC_SDSR still says it is in normal mode instead of self-refresh mode. Below is the snippet of code that I am using.
if(sleepEnabled)
{
/* Step 5: Program the external memory mode register */
tmpmrd = (uint32_t)SDRAM_MODEREG_BURST_LENGTH_8 |
SDRAM_MODEREG_BURST_TYPE_SEQUENTIAL |
SDRAM_MODEREG_CAS_LATENCY_2 |
SDRAM_MODEREG_OPERATING_MODE_STANDARD |
SDRAM_MODEREG_WRITEBURST_MODE_SINGLE;
command.CommandMode = FMC_SDRAM_CMD_SELFREFRESH_MODE;
command.CommandTarget = FMC_SDRAM_CMD_TARGET_BANK2;
command.AutoRefreshNumber = 1;
command.ModeRegisterDefinition = tmpmrd;
taskENTER_CRITICAL();
/* Send the self refresh command */
sdramStatus = HAL_SDRAM_SendCommand(&hsdram1, &command, SDRAM_TIMEOUT);
// *(uint32_t *)SDCMR = data;
while(1);
taskEXIT_CRITICAL();
}
Anyone has ran into this problem? Any suggestions?