74.10.2.2 SDRAM Self-Refresh Mode
SDRAM devices require paced refreshes to maintain data consistency. These refreshes are paced by the DDR_CLK signal. To reduce system frequency or disable DDR_CLK, the SDRAM device must be put in Self-refresh mode.
Self-refresh deactivates the SDRAM clock and automatically executes a refresh operation using the SDRAM device internal refresh counter. Self-refresh mode is effective when the device is not accessed for a long time and the data must be kept for a future use (for context saving or peripheral configurations to recover current system state for example).
As the SDRAM device is not accessed, SDRAM I/Os are configured in Retention state:
- DDR_CLK tied to 0
- DDR_CLKN tied to 0
- DDR_CSN tied to 1
This is the case in some SAMA7G5 low-power modes such as Backup Self-refresh, ULP1 and ULP2. These modes use the following routines. Code example is provided in software deliverables.
Entering SDRAM Self-Refresh Mode
- Save the first eight 32-bit SDRAM words in the backup SRAM.
- Save the calibration result in the backup SRAM.
- Set the static values for DDR_CLK and DDR_CLKN to 0,0 when the pair is disabled.
- Perform a Data Synchronization Barrier (DSB).
- Disable all UDDRC ports.
- Wait for port disable to complete.
- Move system to Self-refresh state.
- Wait until Self-refresh is entered.
- Put the DDR3PHY BYTE DLLs in Bypass mode.
- Power down the DDR3PHY data receivers.
- Power down the Address Control, Clock, Chip Select and ODT pin output drivers.
- Save the first eight 32-bit SDRAM words in the backup SRAM.
- Save the calibration result in the backup SRAM.
- Set the static values for DDR_CLK and DDR_CLKN to 0,0 when the pair is disabled.
- Perform a Data Synchronization Barrier (DSB).
- Disable all UDDRC ports.
- Wait for port disable to complete.
- Move system to Self-refresh
state.
- Wait until Self-refresh is entered.
- Power down the DDR3PHY data receivers.
- Power down the Clock and Chip Select pin output drivers.
- Power down the Address Control and ODT pin output drivers.
- Set the SDRAM I/Os to Retention state by setting SFRBU_DDRPWR.RETENTION.
Exiting SDRAM Self-Refresh Mode
- Power down the CK and CS pin output drivers.
- Power down the ODT[3:0] pin I/Os output drivers in the UDDRC DFI Low Power Configuration register 0 (UDDRC_DFILPCFG0).
- Power down the data input receiver I/Os.
- Move the DDR3PHY BYTE DLLs out of Bypass mode.
- In the UDDRC Software Register Programming Control Enable (UDDRC_SWCTL) register, enable quasi-dynamic register programming.
- Clear the UDDRC_DFIMISC.DFI_INIT_COMPLETE_EN bit.
- Set UDDRC_SWCTL.SW_DONE to indicate
that UDDRC programming is completed.
- Poll the UDDRC_SWSTAT.SW_DONE_ACK bit until it changes to 1, acknowledging that programming is complete.
- Perform a DDR3PHY DLL soft reset ,
and DLL Lock and ITM soft reset commands.
- Wait for completion.
- In the UDDRC_SWCTL register, enable quasi-dynamic register programming.
- Set the DDRC_DFIMISC.DFI_INIT_COMPLETE_EN bit.
- Set UDDRC_SWCTL.SW_DONE to indicate
that UDDRC programming is completed.
- Poll the UDDRC_SWSTAT.SW_DONE_ACK bit until it changes to 1, acknowledging that programming is complete.
- Trigger self-refresh exit.
- Wait until Self-refresh state is exited.
- Enable the five AXI ports with the UDDRC_PCTRL_x.PORT_EN bits.
- Recover the first eight 32-bit SDRAM words from the backup SRAM.
- Recover the calibration result from the backup SRAM.