AM62Ax MCU+ SDK  09.01.00
DDR

Attention
Please note that this driver is supported only on DM R5(WKUP R5) as part SBL examples. It is not supported on MCU-R5.

The DDR driver provides API to configure the DDR module.

Features Supported

  • Ability to enable/disable DDR support in your application
  • Ability to specify the DDR config generated using the "DDR SUBSYSTEM REGISTER CONFIGURATION" tool
  • Ability to enable/disable inline ECC (1b and 2b) in the application
  • Add regions for enabling inline ECC

SysConfig Features

Note
It is strongly recommend to use SysConfig where it is available instead of using direct SW API calls. This will help simplify the SW application and also catch common mistakes early in the development cycle.
  • Ability to specify the DDR config generated using the "DDR SUBSYSTEM REGISTER CONFIGURATION" tool
  • Enables DDR, EMIF module clock when DDR module is selected
  • Toggle inline ECC functionality
  • Add regions for which inline ECC needs to be enabled

Features not Supported

NA

Creating your own DDR config file

Step 1: Generate a DDR config file for your EVM

  • Goto https://dev.ti.com/sysconfig
  • Select "Software Product" as "DDR SUBSYSTEM REGISTER CONFIGURATION"
  • Select "Device" of interest, AM62AX in this case.

DDR SUBSYSTEM REGISTER CONFIGURATION Tool
  • Configure the DDR parameters using the tool
  • Save the generated board_ddrReginit.h in your project workspace or work area

Configure and save the generated file

Step 2: Add the generated DDR config file to your project

Add DDR via SysConfig
  • Specify the path to the generated board_ddrReginit.h file including the filename in the sysconfig text box as shown above
    • Make sure to use forward slash "/" in the file path so that this will work with linux as well as windows build
    • Make sure that path to this is file set in your application include path, as needed.
  • Save the sysconfig project and build your application

Creating your own LPDDR config file

Step 1: Generate a LPDDR config file for your EVM

  • Goto https://dev.ti.com/sysconfig
  • Select "Software Product" as "DDR SUBSYSTEM REGISTER CONFIGURATION"
  • Select "Device" of interest, AM62AX in this case.

DDR SUBSYSTEM REGISTER CONFIGURATION Tool
  • Configure the LPDDR parameters using the tool
  • Save the generated board_ddrReginit.h in your project workspace or work area. Rename the file as "board_lpddrReginit.h".

Configure and save the generated file

Step 2: Add the generated LPDDR config file to your project

Add DDR via SysConfig
  • Specify the path to the generated board_lpddrReginit.h file including the filename in the sysconfig text box as shown above
    • Make sure to use forward slash "/" in the file path so that this will work with linux as well as windows build
    • Make sure that path to this is file set in your application include path, as needed.
  • Save the sysconfig project and build your application

Enabling DDR inline ECC

Step 1: Enable inline ECC in the SBL sysconfig

Enable inline ECC via SysConfig
  • Add regions for which inline ECC needs to be enabled
  • Save the sysconfig project and build your application

Step 2: Generate linux appimage and u-boot.img

  • If SBL is booting linux, 1/9th of DDR has to be reserved in the device tree for storing ECC values
  • For u-boot flow,
    • Reduce the "DDR memory" to 8/9th of whole DDR size in u-boot device tree by modifying the device tree board file (arch/arm/dts/k3-am62a7-sk.dts)
    • Rebuild a53 spl and u-boot.img with this change. Instructions to build A53 uboot can be found in the SDK Linux documentation at Foundational Components » U-Boot » User’s Guide » General Information » Build U-Boot
    • Generate the linux.appimage using the updated A53 SPL
    • Refer Linux Appimage Generator Tool for more details
    • Flash the linux.appimage and u-boot.img
  • For Falcon mode (fast bootmode),
    • Reduce the "DDR memory" to 8/9th of whole DDR size in linux device tree by modifying the device tree board file (arch/arm64/boot/dts/ti/k3-am62a7-sk.dts)
    • Rebuild the linux devicetree blob (dtb). For more information, refer the Linux SDK docs, section Foundational Components > Kernel > Users Guide
    • Generate the linux.appimage using the updated dtb file
    • Refer Linux Appimage Generator Tool for more details
    • Flash the linux.appimage

Important Usage Guidelines

  • Ideally DDR should be enabled in the bootloader application and the SDK bootloader by default enables DDR by default.

Usage Overview

Include the below file to access the APIs

#include <stdio.h>
#include <drivers/ddr.h>
/* DDR register config .h file as generated from DDR SUBSYSTEM REGISTER CONFIGURATION tool
* Make sure path to this file is specified in your application project/makefile include path
*/
#include "drivers/ddr/v0/soc/am64x_am243x/board_ddrReginit.h"
static DDR_Params gDdrParams =
{
/* below values are set using the globals defined in drivers/ddr/v0/soc/am64x_am243x/board_ddrReginit.h */
.clk1Freq = DDRSS_PLL_FREQUENCY_1,
.clk2Freq = DDRSS_PLL_FREQUENCY_2,
.ddrssCtlReg = DDRSS_ctlReg,
.ddrssPhyIndepReg = DDRSS_phyIndepReg,
.ddrssPhyReg = DDRSS_phyReg,
.ddrssCtlRegNum = DDRSS_ctlRegNum,
.ddrssPhyIndepRegNum = DDRSS_phyIndepRegNum,
.ddrssPhyRegNum = DDRSS_phyRegNum,
.ddrssCtlRegCount = DDRSS_CTL_REG_INIT_COUNT,
.ddrssPhyIndepRegCount = DDRSS_PHY_INDEP_REG_INIT_COUNT,
.ddrssPhyRegCount = DDRSS_PHY_REG_INIT_COUNT,
.fshcount = DDRSS_PLL_FHS_CNT,
.enableEccFlag = 0,
.eccRegion = NULL,
};

Initialize DDR

DDR_init(&gDdrParams);

Example Usage

NA

API

APIs for DDR

DDR_init
int32_t DDR_init(DDR_Params *prms)
DDR4 Initialization function.
DDR_Params::clk1Freq
uint64_t clk1Freq
Definition: ddr/v0/ddr.h:107
DDR_Params
DDR config structure.
Definition: ddr/v0/ddr.h:106
ddr.h