SPRUI30H November 2015 – May 2024 DRA745 , DRA746 , DRA750 , DRA756
Table 15-95 shows all steps needed to configure and use the EMIF.
Step | Register/ Bit Field | Value |
---|---|---|
Configure DPLL_DDR to the required frequency: | ||
· IF DPLL_DDR is locked: | CM_IDLEST_DPLL_DDR[0] ST_DPLL_CLK | 0x1 |
Unlock DPLL_DDR | CM_CLKMODE_DPLL_DDR[2:0] DPLL_EN | 0x6 |
· ENDIF | ||
· Configure the DPLL multiplier and divider factors | CM_CLKSEL_DPLL_DDR[18:8] DPLL_MULT and CM_CLKSEL_DPLL_DDR[6:0] DPLL_DIV | 0x- |
· Configure the M2 post-divider factor | CM_DIV_M2_DPLL_DDR[4:0] DIVHS | 0x- |
· Configure the H11 post-divider factor | CM_DIV_H11_DPLL_DDR[5:0] DIVHS | 0x- |
· Lock the DPLL_DDR | CM_CLKMODE_DPLL_DDR[2:0] DPLL_EN | 0x7 |
Disable DLL Override | CM_DLL_CTRL[0] DLL_OVERRIDE | 0x0 |
Configure the output impedance, slew rate and weak pull resistors of the DDR IO cells. For more information, see Section 18.4.6.10 Software Controls for the DDR2/DDR3 I/O Cells. | For EMIF1: | 0x- |
· CTRL_CORE_CONTROL_DDRCACH1_0 | ||
· CTRL_CORE_CONTROL_DDRCH1_0 | ||
· CTRL_CORE_CONTROL_DDRCH1_1 | ||
· CTRL_CORE_CONTROL_DDRCH1_2 | ||
For EMIF2: | ||
· CTRL_CORE_CONTROL_DDRCACH2_0 | ||
· CTRL_CORE_CONTROL_DDRCH2_0 | ||
· CTRL_CORE_CONTROL_DDRCH2_1 | ||
If needed, configure the Vref-Generation Cells. For more information, see Section 18.4.6.11 Reference Voltage for the Device DDR2/DDR3 Receivers. | For EMIF1: | 0x- |
· CTRL_CORE_CONTROL_DDRIO_0 | ||
For EMIF2: | ||
· CTRL_CORE_CONTROL_DDRIO_1 | ||
Set the number of DQ samples required for read leveling | CTRL_WKUP_EMIF1_SDRAM_CONFIG_EXT[15:14] EMIF1_REG_PHY_NUM_OF_SAMPLES | 0x3 |
CTRL_WKUP_EMIF2_SDRAM_CONFIG_EXT[15:14] EMIF2_REG_PHY_NUM_OF_SAMPLES | 0x3 | |
Choose SDRAM read response on only one DQ bit during read leveling | CTRL_WKUP_EMIF1_SDRAM_CONFIG_EXT[12] EMIF1_REG_PHY_ALL_DQ_MPR_RD_RESP | 0x0 |
CTRL_WKUP_EMIF2_SDRAM_CONFIG_EXT[12] EMIF2_REG_PHY_ALL_DQ_MPR_RD_RESP | 0x0 | |
Configure ODT for the device DDR IOs | CTRL_WKUP_EMIF1_SDRAM_CONFIG_EXT [6:5] EMIF1_PHY_RD_LOCAL_ODT | 0x1 for 60 Ohms |
0x2 for 80 Ohms | ||
0x3 for 120 Ohms | ||
CTRL_WKUP_EMIF2_SDRAM_CONFIG_EXT [6:5] EMIF2_PHY_RD_LOCAL_ODT | 0x1 for 60 Ohms | |
0x2 for 80 Ohms | ||
0x3 for 120 Ohms | ||
IF ECC is used OR IF special (6) use-cases: | ||
Enable ECC | CTRL_WKUP_EMIF1_SDRAM_CONFIG_EXT[16] EMIF1_EN_ECC | 0x1 |
ENDIF | ||
Based on the memory type other bits from CTRL_WKUP_EMIF1_SDRAM_CONFIG_EXT/ CTRL_WKUP_EMIF2_SDRAM_CONFIG_EXT can also be configured. | ||
Read the EMIF_IODFT_TLGC register | EMIF_IODFT_TLGC | RD_VAL_1 |
Read the EMIF_DDR_PHY_CONTROL_2 register | EMIF_DDR_PHY_CONTROL_2 | RD_VAL_2 |
IF External warm reset or global warm software reset has occurred: | PRM_RSTST[5]EXTERNAL_WARM_RST or | 0x1 |
PRM_RSTST[1] GLOBAL_WARM_SW_RST | 0x1 | |
Reset the DDR PHY | EMIF_IODFT_TLGC[10] RESET_PHY | 0x1 |
ENDIF | ||
Program the necessary ratio values to the EMIF_EXT_PHY_CONTROL_1 register | EMIF_EXT_PHY_CONTROL_1[19:10] PHY_REG_CTRL_SLAVE_RATIO1 | 0x80 if PHY_INVERT_CLKOUT = 0x0 or 0x100 if PHY_INVERT_CLKOUT = 0x1 |
EMIF_EXT_PHY_CONTROL_1[9:0] PHY_REG_CTRL_SLAVE_RATIO0 | 0x80 if PHY_INVERT_CLKOUT = 0x0 or 0x100 if PHY_INVERT_CLKOUT = 0x1 | |
Program the shadow register of EMIF_EXT_PHY_CONTROL_1 | EMIF_EXT_PHY_CONTROL_1_SHADOW | EMIF_EXT_PHY_CONTROL_1 |
If software leveling will be used, program registers EMIF_EXT_PHY_CONTROL_2 through EMIF_EXT_PHY_CONTROL_21 and their corresponding shadow registers NOTE: Software leveling is not recommended to be used. Hardware leveling must be used instead. | EMIF_EXT_PHY_CONTROL_2/EMIF_EXT_PHY_CONTROL_2_SHADOW through EMIF_EXT_PHY_CONTROL_21/EMIF_EXT_PHY_CONTROL_21_SHADOW | 0x- |
Program the necessary delay values to the EMIF_EXT_PHY_CONTROL_22 register | EMIF_EXT_PHY_CONTROL_22 [24:16] PHY_REG_FIFO_WE_IN_DELAY (1) (2) | Recommended value is 0x0 |
EMIF_EXT_PHY_CONTROL_22 [8:0] PHY_REG_CTRL_SLAVE_DELAY (1) (2) | Recommended value is 0x0 | |
Program the shadow register of EMIF_EXT_PHY_CONTROL_22 | EMIF_EXT_PHY_CONTROL_22_SHADOW (1) (2) | EMIF_EXT_PHY_CONTROL_22 |
Program the necessary delay values to the EMIF_EXT_PHY_CONTROL_23 register | EMIF_EXT_PHY_CONTROL_23[24:16] PHY_REG_WR_DQS_SLAVE_DELAY (1) (2) | Recommended value is 0x0 |
EMIF_EXT_PHY_CONTROL_23[8:0] PHY_REG_RD_DQS_SLAVE_DELAY (1) (2) | Recommended value is 0x0 | |
Program the shadow register of EMIF_EXT_PHY_CONTROL_23 | EMIF_EXT_PHY_CONTROL_23_SHADOW (1) (2) | EMIF_EXT_PHY_CONTROL_23 |
Program the EMIF_EXT_PHY_CONTROL_24 register | EMIF_EXT_PHY_CONTROL_24[30:24] REG_PHY_DQ_OFFSET_HI (3) | 0x- |
EMIF_EXT_PHY_CONTROL_24[16] REG_PHY_GATELVL_INIT_MODE | Recommended value is 0x1 | |
EMIF_EXT_PHY_CONTROL_24[12] REG_PHY_USE_RANK0_DELAYS (2) | 0x1 | |
EMIF_EXT_PHY_CONTROL_24[8:0] REG_PHY_WR_DATA_SLAVE_DELAY (1) (2) | Recommended value is 0x0 | |
Program the shadow register of EMIF_EXT_PHY_CONTROL_24 | EMIF_EXT_PHY_CONTROL_24_SHADOW | EMIF_EXT_PHY_CONTROL_24 |
Program the necessary offset ratio values to the EMIF_EXT_PHY_CONTROL_25 register | EMIF_EXT_PHY_CONTROL_25[27:21] REG_PHY_DQ_OFFSET3 (3) | 0x- |
EMIF_EXT_PHY_CONTROL_25[20:14] REG_PHY_DQ_OFFSET2 (3) | 0x- | |
EMIF_EXT_PHY_CONTROL_25[13:7] REG_PHY_DQ_OFFSET1 (3) | 0x- | |
EMIF_EXT_PHY_CONTROL_25[6:0] REG_PHY_DQ_OFFSET0 (3) | 0x- | |
Program the shadow register of EMIF_EXT_PHY_CONTROL_25 | EMIF_EXT_PHY_CONTROL_25_SHADOW | EMIF_EXT_PHY_CONTROL_25 |
If hardware leveling (read-write leveling) will be used, program with zeros registers EMIF_EXT_PHY_CONTROL_26 through EMIF_EXT_PHY_CONTROL_35 and their corresponding shadow registers | EMIF_EXT_PHY_CONTROL_26/ EMIF_EXT_PHY_CONTROL_26_SHADOW through EMIF_EXT_PHY_CONTROL_35/ EMIF_EXT_PHY_CONTROL_35_SHADOW | 0x0 |
Program the EMIF_EXT_PHY_CONTROL_36 register | EMIF_EXT_PHY_CONTROL_36 | 0x- |
Program the shadow register of EMIF_EXT_PHY_CONTROL_36 | EMIF_EXT_PHY_CONTROL_36_SHADOW | EMIF_EXT_PHY_CONTROL_36 |
Define the SDRAM refresh rate in the shadow register of EMIF_SDRAM_REFRESH_CONTROL | EMIF_SDRAM_REFRESH_CONTROL_SHADOW [15:0] REFRESH_RATE_SHDW | 0x- |
Define the SDRAM refresh rate | EMIF_SDRAM_REFRESH_CONTROL[15:0] REFRESH_RATE | REFRESH_RATE_SHDW |
Disable SDRAM initialization and refreshes | EMIF_SDRAM_REFRESH_CONTROL[31] INITREF_DIS | 0x1 |
Configure the timing parameters in EMIF_SDRAM_TIMING_1 (4) | 0x- | |
Program the shadow register of EMIF_SDRAM_TIMING_1 | EMIF_SDRAM_TIMING_1_SHADOW (4) | EMIF_SDRAM_TIMING_1 |
Configure the timing parameters in EMIF_SDRAM_TIMING_2 (4) | 0x- | |
Program the shadow register of EMIF_SDRAM_TIMING_2 | EMIF_SDRAM_TIMING_2_SHADOW (4) | EMIF_SDRAM_TIMING_2 |
Configure the timing parameters in EMIF_SDRAM_TIMING_3 (4) | 0x- | |
Program the shadow register of EMIF_SDRAM_TIMING_3 | EMIF_SDRAM_TIMING_3_SHADOW (4) | EMIF_SDRAM_TIMING_3 |
Program the EMIF_LPDDR2_NVM_TIMING (5) and EMIF_LPDDR2_NVM_TIMING_SHADOW (5) registers. NOTE: These registers are not supported. They are kept only for code compatibility. | 0x0 | |
Disable automatic power management | EMIF_POWER_MANAGEMENT_CONTROL[10:8] LP_MODE | 0x0 |
Define the number of DDR clock cycles after which the EMIF puts the external SDRAM in Power Down mode when EMIF is idle | EMIF_POWER_MANAGEMENT_CONTROL[15:12] PD_TIM | 0x- |
Define the number of DDR clock cycles after which the EMIF puts the external SDRAM in Self Refresh mode when EMIF is idle | EMIF_POWER_MANAGEMENT_CONTROL[7:4] SR_TIM | 0x- |
Program the shadow register of EMIF_POWER_MANAGEMENT_CONTROL | EMIF_POWER_MANAGEMENT_CONTROL_SHADOW | EMIF_POWER_MANAGEMENT_CONTROL |
Configure the System and MPU maximum number of commands in the command FIFO | EMIF_OCP_CONFIG[27:24] SYS_THRESH_MAX | 0x- |
EMIF_OCP_CONFIG[23:20] MPU_THRESH_MAX | 0x- | |
Program the EMIF_IODFT_TLGC register | EMIF_IODFT_TLGC | RD_VAL_1 |
Determine the required wait time after a phy_dll_calib is generated before another command can be sent | EMIF_DLL_CALIB_CTRL[19:16] ACK_WAIT | 0x- |
Determine the interval between phy_dll_calib generation | EMIF_DLL_CALIB_CTRL[8:0] DLL_CALIB_INTERVAL | 0x- |
Program the shadow register of EMIF_DLL_CALIB_CTRL | EMIF_DLL_CALIB_CTRL_SHADOW | EMIF_DLL_CALIB_CTRL |
Define the interval (number of refresh periods) between ZQCS commands | EMIF_SDRAM_OUTPUT_IMPEDANCE_CALIBRATION_CONFIG[15:0] ZQ_REFINTERVAL | 0x- |
Define the number of ZQCS intervals that build the ZQCL duration | EMIF_SDRAM_OUTPUT_IMPEDANCE_CALIBRATION_CONFIG[17:16] ZQ_ZQCL_MULT | 0x- |
Enable issuing of ZQCL on Self- Refresh, Active Power-Down, and Precharge Power-Down exit | EMIF_SDRAM_OUTPUT_IMPEDANCE_CALIBRATION_CONFIG[28] ZQ_SFEXITEN | 0x1 |
Enable ZQ calibration for CS0 | EMIF_SDRAM_OUTPUT_IMPEDANCE_CALIBRATION_CONFIG[30] ZQ_CS0EN | 0x1 |
Program the EMIF_TEMP_ALERT_CONFIG (5) register. NOTE: This register is not supported on this device. It is kept only for code compatibility. | 0x- | |
Program the EMIF_READ_WRITE_LEVELING_RAMP_WINDOW register. NOTE: Incremental leveling is not supported on this device. | 0x- | |
IF Memory type == DDR3 AND SDRAM content doesn't need to be maintained: | ||
Enable read-write leveling | EMIF_READ_WRITE_LEVELING_RAMP_CONTROL[31] RDWRLVL_EN | 0x1 |
ELSE: | ||
Disable read-write leveling | EMIF_READ_WRITE_LEVELING_RAMP_CONTROL[31] RDWRLVL_EN | 0x0 |
ENDIF | ||
Program bits [30:0] of EMIF_READ_WRITE_LEVELING_RAMP_CONTROL NOTE: Incremental leveling is not supported on this device. | 0x- | |
Program the EMIF_READ_WRITE_LEVELING_CONTROL register | 0x0 | |
Define the read latency for the read data from SDRAM in number of DDR clock cycles | EMIF_DDR_PHY_CONTROL_1[4:0] READ_LATENCY | 0x- (typical value >= (CL + 4)) |
Configure whether the MDLL lock is asserted based on single sample or average of 16 samples | EMIF_DDR_PHY_CONTROL_1[9] PHY_FAST_DLL_LOCK | 0x- |
Define the maximum number of delay line taps variation while maintaining the master DLL lock. The recommended value is 0x10 | EMIF_DDR_PHY_CONTROL_1[17:10] PHY_DLL_LOCK_DIFF | 0x10 |
Configure whether the clock to the SDRAM is inverted or not | EMIF_DDR_PHY_CONTROL_1[18] PHY_INVERT_CLKOUT | 0x- |
When leveling is used set PHY_DIS_CALIB_RST to 0x0 | EMIF_DDR_PHY_CONTROL_1[19] PHY_DIS_CALIB_RST | 0x0 |
Program the slave delay line delays to support 2× mode | EMIF_DDR_PHY_CONTROL_1[21] PHY_HALF_DELAYS | 0x1 |
IF Memory type == DDR3: | ||
Unmask read data eye training, DQS gate training and write leveling training during full leveling | EMIF_DDR_PHY_CONTROL_1[27] RDLVL_MASK | 0x0 |
EMIF_DDR_PHY_CONTROL_1[26] RDLVLGATE_MASK | 0x0 | |
EMIF_DDR_PHY_CONTROL_1[25] WRLVL_MASK | 0x0 | |
ELSE: | ||
Mask read data eye training, DQS gate training and write leveling training during full leveling | EMIF_DDR_PHY_CONTROL_1[27] RDLVL_MASK | 0x1 |
EMIF_DDR_PHY_CONTROL_1[26] RDLVLGATE_MASK | 0x1 | |
EMIF_DDR_PHY_CONTROL_1[25] WRLVL_MASK | 0x1 | |
ENDIF | ||
Program the shadow register of EMIF_DDR_PHY_CONTROL_1 | EMIF_DDR_PHY_CONTROL_1_SHADOW | EMIF_DDR_PHY_CONTROL_1 |
Program the EMIF_DDR_PHY_CONTROL_2 register | EMIF_DDR_PHY_CONTROL_2 (5) | RD_VAL_2 |
If needed, configure and enable the priority-to-class-of-service mapping for the commands in the command FIFO | EMIF_PRIORITY_TO_CLASS_OF_SERVICE_MAPPING | 0x- |
If needed, configure and enable the master-ID-to-class-of-service mapping for the commands in the command FIFO | EMIF_CONNECTION_ID_TO_CLASS_OF_SERVICE_1_MAPPING | 0x- |
EMIF_CONNECTION_ID_TO_CLASS_OF_SERVICE_2_MAPPING | 0x- | |
Chose whether Mflag or Class of Service is used | EMIF_READ_WRITE_EXECUTION_THRESHOLD[31] MFLAG_OVERRIDE | 0x- |
Configure the write threshold after which EMIF switches to read commands | EMIF_READ_WRITE_EXECUTION_THRESHOLD[12:8] WR_THRSH | 0x- |
Configure the read threshold after which EMIF switches to write commands | EMIF_READ_WRITE_EXECUTION_THRESHOLD[4:0] RD_THRSH | 0x- |
Configure the priority rise counters | EMIF_COS_CONFIG | 0x- |
IF Memory type == DDR3: | ||
Configure the SDRAM refresh rate with a value of 31.25μs to get 500µs delay between RESET de-assertion to CKE assertion after power-up | EMIF_SDRAM_REFRESH_CONTROL_SHADOW [15:0] REFRESH_RATE_SHDW | 0x- |
Program the EMIF_SDRAM_REFRESH_CONTROL register with value same as its shadow register | EMIF_SDRAM_REFRESH_CONTROL[15:0] REFRESH_RATE | REFRESH_RATE_SHDW |
ELSEIF Memory type == DDR2: | ||
Configure the SDRAM refresh rate with value used initially to get 200µs delay between POWER UP and PRECHARGE ALL command | EMIF_SDRAM_REFRESH_CONTROL_SHADOW [15:0] REFRESH_RATE_SHDW | 0x- |
Program the EMIF_SDRAM_REFRESH_CONTROL register with value same as its shadow register | EMIF_SDRAM_REFRESH_CONTROL[15:0] REFRESH_RATE | REFRESH_RATE_SHDW |
ELSEIF Memory type == LPDDR2: | ||
Configure the SDRAM refresh rate with value used initially to get 200µs delay between POWER UP and RESET command to LPDDR2 | EMIF_SDRAM_REFRESH_CONTROL_SHADOW [15:0] REFRESH_RATE_SHDW | 0x- |
Program the EMIF_SDRAM_REFRESH_CONTROL register with value same as its shadow register | EMIF_SDRAM_REFRESH_CONTROL[15:0] REFRESH_RATE | REFRESH_RATE_SHDW |
ENDIF | ||
Assign the external bank address bits from lower or higher L3 address as shown in Section 15.3.4.12, SDRAM Address Mapping | EMIF_SDRAM_CONFIG_2[27] EBANK_POS | 0x- |
Select the SDRAM type | EMIF_SDRAM_CONFIG[31:29] SDRAM_TYPE | 0x- |
Assign internal bank address bits from L3 address as shown in Section 15.3.4.12, SDRAM Address Mapping | EMIF_SDRAM_CONFIG[28:27] IBANK_POS | 0x- |
Choose SDRAM data bus width | EMIF_SDRAM_CONFIG[15:14] NARROW_MODE | 0x- |
Define CAS latency when accessing connected SDRAM devices. | EMIF_SDRAM_CONFIG[13:10] CL | 0x- |
Define the number of row address bits of connected SDRAM device. | EMIF_SDRAM_CONFIG[9:7] ROWSIZE | 0x- |
Define the number of banks inside connected SDRAM device. | EMIF_SDRAM_CONFIG[6:4] IBANK | 0x- |
Define the internal page size of connected SDRAM device. | EMIF_SDRAM_CONFIG[2:0] PAGESIZE | 0x- |
Wait 1ms | ||
Configure the SDRAM refresh rate with value according to the actual memory refresh period requirements | EMIF_SDRAM_REFRESH_CONTROL_SHADOW [15:0] REFRESH_RATE_SHDW | 0x- |
Program the EMIF_SDRAM_REFRESH_CONTROL register with value same as its shadow register | EMIF_SDRAM_REFRESH_CONTROL[15:0] REFRESH_RATE | REFRESH_RATE_SHDW |
IF Memory type == DDR3 AND Hardware leveling is used AND SDRAM content doesn't need to be maintained: | ||
IF ECC is used: | ||
Perform dummy ECC setup just to allow hardware leveling of ECC memories | EMIF_ECC_ADDRESS_RANGE_1 | 0x0 |
EMIF_ECC_ADDRESS_RANGE_2 | 0x0 | |
EMIF_ECC_CTRL_REG | 0xC000 0000 | |
ENDIF | ||
Clear the phy_reg_fifo_we_in_misaligned_sticky status flag | EMIF_EXT_PHY_CONTROL_36[8] REG_PHY_FIFO_WE_IN_MISALIGNED_CLR | 0x1 |
Temporarily disable SDRAM refreshes | EMIF_SDRAM_REFRESH_CONTROL[31] INITREF_DIS | 0x1 |
Trigger read-write leveling | EMIF_READ_WRITE_LEVELING_CONTROL[31] RDWRLVLFULL_START | 0x1 |
Wait 300µs | ||
Wait till read-write leveling completes | EMIF_READ_WRITE_LEVELING_CONTROL[31] RDWRLVLFULL_START | 0x0 |
Enable the temporarily disabled SDRAM refreshes | EMIF_SDRAM_REFRESH_CONTROL[31] INITREF_DIS | 0x0 |
Check EMIF_STATUS for leveling timeouts | EMIF_STATUS[6] RDLVLGATETO | 0x1 |
EMIF_STATUS[5] RDLVLTO | 0x1 | |
EMIF_STATUS[4] WRLVLTO | 0x1 | |
IF special (6) use-cases: | ||
Copy EMIF_PHY_STATUS_12 through EMIF_PHY_STATUS_16 to EMIF_EXT_PHY_CONTROL_2 through EMIF_EXT_PHY_CONTROL_6 | ||
Copy EMIF_PHY_STATUS_7 through EMIF_PHY_STATUS_11 to EMIF_EXT_PHY_CONTROL_7 through EMIF_EXT_PHY_CONTROL_11 | ||
Copy EMIF_PHY_STATUS_17 through EMIF_PHY_STATUS_26 to EMIF_EXT_PHY_CONTROL_12 through EMIF_EXT_PHY_CONTROL_21 | ||
Mask read data eye training, DQS gate training and write leveling training to disable the use of registers EMIF_PHY_STATUS_7 through EMIF_PHY_STATUS_26 registers | EMIF_DDR_PHY_CONTROL_1[27:25] | 0x7 |
Program the shadow register of EMIF_DDR_PHY_CONTROL_1 | EMIF_DDR_PHY_CONTROL_1_SHADOW | EMIF_DDR_PHY_CONTROL_1 |
Disable read-write leveling | EMIF_READ_WRITE_LEVELING_RAMP_CONTROL[31] RDWRLVLFULL_START | 0x0 |
ENDIF | ||
Clear the ECC control register | EMIF_ECC_CTRL_REG | 0x0 |
ENDIF | ||
Configure the LISA_MAP registers based on the EMIF1/EMIF2 usage and EMIF interleaving modes. For more information see Section 15.2.4.2, Addressing Management with LISA. | DMM_LISA_MAP_i (i = 0 to 3) | 0x- |
MA_LISA_MAP_i (i = 0 to 3) | 0x- |