4.1.1 DDR3-SDRAM/DDR3L-SDRAM Initialization

The initialization sequence is performed by software. The DDR3-SDRAM devices are initialized by the sequence described in the table below.

Note: These settings were verified as functional for the Micron MT52L256M32D1PF-107WT device. Application to other brands should be verified against their respective data sheets.
Table 4-1. DDR3-SDRAM/DDR3L-SDRAM Initialization
StepActionRegisterSetting
1Program the memory device typeMPDDRC_MDMD = 4 (for DDR3), DBW = 0 (32 bits)
2Program the shift sampling valueMPDDRC_RD_DATA_PATHSection SDRAM Controller Configuration provides values for these fields. These values depend on the DDR clock.
3Program DDR3-SDRAM featuresMPDDRC_CR MPDDRC_TPR0

MPDDRC_TPR1

MPDDRC_TPR2

4Issue a NOP command(4)MPDDRC_MRMODE = 1
5500 μs delay(1)
6Issue a NOP command(4)MPDDRC_MRMODE = 1
7Issue an EMRS2 cycle(2)MPDDRC_MRMODE = 5
8Issue an EMRS3 cycle(2)MPDDRC_MRMODE = 5
9Issue an EMRS1 cycle(2)MPDDRC_MRMODE = 5
10Write a ‘1’ to the DLL bitMPDDRC_CRDLL = 1
11Issue a Mode Register Set (MRS) cycle(3)MPDDRC_MRMODE = 3
12Issue a Calibration command (MRS) (3)MPDDRC_MRMODE = 6
13Provide a Normal Mode command(4)MPDDRC_MRMODE = 0
14Write the refresh rate in COUNT fieldMPDDRC_RTRCOUNT = Trefi/Tck
Note:
  1. To issue a delay:

    • disable interrupts;
    • compute a deadline = ROUND_INT_DIV((timer_channel_freq/1000)*count, 1000), where count is the delay in µs;

    • start a timer and wait for the timer to reach the deadline;

    • enable interrupts.
  2. To issue an Extended Mode Register Set (EMRS) cycle, after setting the MODE field to 5, read MPDDRC_MR and add a memory barrier assembler instruction just after the read. Then perform a write access to the DDR3-SDRAM device so that the BA[2:0] signals are set as follows:

    • BA[2] is set to 0, BA[1] is set to 0, BA[0] is set to 1 for EMRS1.
    • BA[2] is set to 0, BA[1] is set to 1, BA[0] is set to 0 for EMRS2.
    • BA[2] is set to 0, BA[1] is set to 1, BA[0] is set to 1 for EMRS3.

      The address at which the write access is issued in order to acknowledge the command needs to be calculated so that the BA[2:0] signals are in the right state for an EMRS cycle.

  3. After setting the MODE field, read MPDDRC_MR and add a memory barrier assembler instruction just after the read. Perform a write access to acknowledge the command so that BA[2:0] signals are set to 0 (write at BASE_ADDRESS_DDR).
  4. After setting the MODE field, read MPDDRC_MR and add a memory barrier assembler instruction just after the read. Perform a write access at any address to acknowledge the command.


Refer to chapter ”Multiport DDR-SDRAM Controller (MPDDRC)” of the SAMA5D2 Series data sheet for more information.