AM64x MCU+ SDK  08.00.00
EVM Setup

AM64X EVM

Note
Refer to EVM page for more details on the EVM, https://www.ti.com/tool/TMDS64GPEVM

Cable Connections

  • The figure below shows some important cable connections, ports and switches.
    • Take note of the location of the "BOOTMODE" switch, this is used to switch between different boot modes like OSPI, UART, SD, NOBOOT mode

AM64X-EVM

Setup UART Terminal

  • Many examples use a standard UART terminal to log the output from the examples. You can use any UART terminal program for the same. Below steps show how to setup the UART terminal from CCS.
  • First identify the UART port as enumerated on the host machine.
    • Make sure that the EVM and UART cable connected as shown in Cable Connections
    • In windows, you can use the "Device Manager" to see the detected UART ports
      • Search "Device Manager" in Windows Search Box in the Windows taskbar.
    • If dont see any USB serial ports listed in "Device Manager" under "Ports (COM & LPT)", then make sure you have installed the UART to USB driver from FTDI, https://www.ftdichip.com/FTDrivers.htm.

Identify UART Port in Windows Device Manager
  • In CCS, goto "View > Terminal"

UART Terminal Menu
  • Open a new UART terminal

Open New UART Terminal
  • Select the UART port, keep other options to default, i.e 115200 baud rate - 8 data bits - No parity - 1 stop bit,
    • We use the 1st USB serial port, as seen in the device manager, for below in the SDK
      • Flashing application via UART
      • Booting application via UART
      • Console output for examples which run from R5F
    • We use the 2st USB serial port, as seen in the device manager, as terminal output for examples which run from M4F

Connect to UART port
  • In this screenshot this happens to be COM13 and COM14 however on your machine this could be different. One tip to make sure there is no mistake in identifying the UART port is to disconnect all other UART to USB devices other than this EVM before checking in device manager.

Flash SOC Initialization Binary

Attention
This is a recommended one time step that needs to be done before you can load and run programs via CCS
If this step fails, maybe due to bad flash in EVM, then try one of the other SOC initialization steps mentioned at SOC Initialization
This step needs to be done once unless the OSPI flash has been erased or some other application has been flashed
  • A quick recap of steps done so far that are needed for the flashing to work
    • Make sure the UART port used for terminal is identified as mentioned in Setup UART Terminal
    • Make sure python3 is installed as mentioned in Python3
    • Make sure you have the EVM power cable and UART cable connected as shown in Cable Connections
  • POWER-OFF the EVM
  • Set boot mode to UART BOOTMODE as shown in below image

UART BOOT MODE
  • POWER-ON the EVM
  • You should see character "C" getting printed on the UART terminal every 2-3 seconds as shown below

UART output in UART BOOT MODE
  • Close the UART terminal as shown below. This is important, else the UART script in next step wont be able to connect to the UART port.

Close UART terminal
  • Open a command prompt and run the below command to flash the SOC initialization binary to the EVM.
      cd ${SDK_INSTALL_PATH}/tools/boot
      python uart_uniflash.py -p COM<x> --cfg=sbl_prebuilt/am64x-evm/default_sbl_null.cfg
    
    • Here COM<x> is the port name of the identified UART port in Windows.
    • On Linux,
      • The name for UART port is typically something like /dev/ttyUSB0
      • On some Linux systems, one needs to use python3 to invoke python3.x, just python command may invoke python 2.x which will not work with the flashing script.
  • When the flashing is in progress you will see something like below

Flash in progress
  • After all the flashing is done, you will see something like below

Flashing successful
  • If flashing has failed, see Flash tool error messages and solutions, and resolve the errors.
  • If flashing is successful, do the next steps ...
  • POWER-OFF the EVM
  • Switch the EVM boot mode to OSPI mode as shown below,

OSPI BOOT MODE
  • Re-connect the UART terminal in CCS window as shown in Setup UART Terminal
  • POWER-ON the EVM
  • You should see output like below on the UART terminal
      Starting NULL Bootloader ...
    
      DMSC Firmware Version 21.1.1--v2021.01a (Terrific Lla
      DMSC Firmware revision 0x15
      DMSC ABI revision 3.1
    
      INFO: Bootloader_runCpu:151: CPU r5f1-0  is initialized to 800000000 Hz !!!
      INFO: Bootloader_runCpu:151: CPU r5f1-1 is initialized to 800000000 Hz !!!
      INFO: Bootloader_runCpu:151: CPU m4f0-0 is initialized to 400000000 Hz !!!
      INFO: Bootloader_loadSelfCpu:203: CPU r5f0-0 is initialized to 800000000 Hz !!!
      INFO: Bootloader_loadSelfCpu:203: CPU r5f0-1 is initialized to 800000000 Hz !!!
      INFO: Bootloader_runSelfCpu:215: All done, reseting self ...
    
  • Congratulations now the EVM is setup for loading and running from CCS !!!
  • You dont need to do these steps again unless you have flashed some other binary to the flash.
  • Now you can build a example of interest (see Build a Hello World example) and then run it (see CCS Launch, Load and Run)

DDR Initialization

  • By default none of the SOC initialization methods initialize DDR, or for that matter any other peripherals.
  • The SOC initialization only enables all the CPUs, set them to a valid clock and make them run a while(1) loop.
  • To initialize DDR, in particular, do the additional step below from CCS GEL menu.
  • Launch CCS debug session as mentioned here, Launch CCS
  • Connect to MAIN_Cortex_R5_0_0

Connect to R5F0-0
  • Run the DDR initialization from GEL menu as shown below,

DDR initialization via GEL menu
  • After the DDR initialization is done you will see prints like below in the CCS "CIO" console,
      MAIN_Cortex_R5_0_0: GEL Output: --->>> DDR4 Initialization is in progress ... <<<---
      MAIN_Cortex_R5_0_0: GEL Output: --->>> ECC Disabled <<<---
      MAIN_Cortex_R5_0_0: GEL Output: --->>> DDR controller programming in progress.. <<<---
      MAIN_Cortex_R5_0_0: GEL Output: --->>> DDR controller programming completed... <<<---
      MAIN_Cortex_R5_0_0: GEL Output: --->>> DDR PI programming in progress.. <<<---
      MAIN_Cortex_R5_0_0: GEL Output: --->>> DDR PI programming completed... <<<---
      ...
      MAIN_Cortex_R5_0_0: GEL Output: --->>> DDR Initialization completed... <<<---
      MAIN_Cortex_R5_0_0: GEL Output: --->>> DDR4 Initialization is DONE! <<<---
    
  • Now you can load programs to DDR and they can access DDR. Note, however for R5F and M4F to access DDR, there needs to be a MPU region setup to cover the DDR memory. By default, most SDK examples dont setup this MPU region. Also all code that executes before this MPU region is setup MUST NOT execute from DDR.

Additional Details

Note
This section has more details on AM64X-EVM. This is mainly for reference and can be skiped unless referred to by other pages in this user guide.

SOC Initialization

Before any program can be loaded and run on the EVM, the SOC needs to be initialized. Below sections describes the various options available for SOC initialization.

It is recommended to use the method mentioned in Flash SOC Initialization Binary. However in some cases, additional methods described below can be used esp when running on your own custom EVM and flash driver is not yet available for that EVM.

SOC Initialization Using SD BOOT

Note
This step needs to be done once, unless the SD card is reformatted and/or the boot file is changed
  • Format a micro-SD card to contain a FAT partition as the primary partition
  • In windows,
    • Insert a micro-SD in a USB card reader, connect to the PC.
    • In "Windows Explorer", select the SD drive, right-click, select "Format"
      Format SD Card
    • Format as FAT filesystem
      Format as FAT partition
    • After formatting is done, you need to mark the partition as "ACTIVE".
      • There are various ways to do this in Windows, see online forums for various options
      • Here we use the GUI tool "Active Partition Manager" http://www.pcdisk.com/index.html
        • Download and install the tool
        • Launch the tool and select "Open Disk Image"
        • You will see all the disks present on the system, including the SD card FAT partition
        • Right click on the SD card FAT partition
        • Select "Change Attributes"
        • Enable the option "Mark Partition As Active", click "OK"
        • Close the application
  • In Linux,
    • Refer to online forums to create FAT partition on a SD card and set it as "ACTIVE"
    • gparted is one GUI based tool that can be used to create partitions, format them and set them as "ACTIVE"
      sudo apt install gparted
      
  • Copy the below file to the newly formatted FAT partition on the SD card and rename it as tiboot3.bin
      copy file to SD card => ${SDK_INSTALL_PATH}/tools/boot/sbl_prebuilt/am64x-evm/sbl_null.release.tiimage
      rename in SD card as => tiboot3.bin
    
  • Eject the SD card
  • POWER-OFF the EVM
  • Set EVM to SD BOOT MODE by setting the switch setting as shown below

SD BOOT MODE
  • Insert the formated SD card in the SD card slot in the EVM
  • Open a UART terminal as mentioned in Setup UART Terminal
  • POWER-ON the EVM
  • You should see output like below on the UART terminal
      Starting NULL Bootloader ...
    
      DMSC Firmware Version 21.1.1--v2021.01a (Terrific Lla
      DMSC Firmware revision 0x15
      DMSC ABI revision 3.1
    
      INFO: Bootloader_runCpu:151: CPU r5f1-0  is initialized to 800000000 Hz !!!
      INFO: Bootloader_runCpu:151: CPU r5f1-1 is initialized to 800000000 Hz !!!
      INFO: Bootloader_runCpu:151: CPU m4f0-0 is initialized to 400000000 Hz !!!
      INFO: Bootloader_loadSelfCpu:203: CPU r5f0-0 is initialized to 800000000 Hz !!!
      INFO: Bootloader_loadSelfCpu:203: CPU r5f0-1 is initialized to 800000000 Hz !!!
      INFO: Bootloader_runSelfCpu:215: All done, reseting self ...
    
  • Congratulations now the EVM is setup for loading and running from CCS !!!
  • You dont need to do these steps again unless you have changed or re-formatted or deleted/changed the tiboot3.bin file.

SOC Initialization Using CCS Scripting

Set Environment Variable
Note
This step needs to be done once and is needed for the SOC initialization script load_dmsc.js to find certain initialization files within the SDK folder. This variable is not used otherwise in the build process. If you dont like adding variables in the environment, then you need to edit the file ${SDK_INSTALL_PATH}/tools/ccs_load/am64x_am243x/load_dmsc.js and specify the SDK path in the file itself.
  • Add path to the SDK folder as a environment variable in the host machine.
  • In windows, goto "Windows Task Bar Search" and search for "environment variables for your account"
    Environment Variables For Your Account
  • Add a new variable named MCU_PLUS_SDK_AM64X_PATH and point it to the path where the SDK is installed

Add New Environment Variable For Your Account
  • In Linux, usually you need to add a line as below in the ${HOME}/.bashrc,
    export MCU_PLUS_SDK_AM64X_PATH=${HOME}/ti/mcu_plus_sdk_am64x_{sdk version}/
  • If CCS is open, close and reopen CCS for the CCS to be able to see the updated environment variable
Run the SOC Initialization Script
Attention
This step needs to be done every time the EVM is power-cycled.
  • POWER-OFF the EVM
  • Make sure below cables are connected as shown in Cable Connections
    • Power cable
    • JTAG cable
  • Set EVM in NOBOOT mode as shown below
    NO BOOT MODE
  • POWER-ON the EVM
  • Launch the target configuration created with Create Target Configuration

Launch Target Configuration
  • You will see the AM64X target configuration in the "Debug" window as shown below

Target Configuration After Launch
  • Goto "CCS Toolbar > View > Scripting Console"
  • Type the below command in the scripting console and press "enter", to load DMSC FW and initialize the SOC
    • In Windows, assuming the SDK is installed at C:/ti/mcu_plus_sdk_{soc}_{sdk version}
      loadJSFile "C:/ti/mcu_plus_sdk_{soc}_{sdk version}/tools/ccs_load/am64x_am243x/load_dmsc.js"
      

Scripting Console
  • In Linux, run the same command, only the path would be a Linux path like /home/{username}/ti/mcu_plus_sdk_{soc}_{sdk version}/tools/ccs_load/am64x_am243x/load_dmsc.js
  • After successful execution of this script one would see logs as below
    • In the scripting console, this is log from the script itself.
      Scripting Console Log
    • In the AM64X "CIO" console, this is log from the R5F.
      AM64X CIO Console R5F Log
    • In the AM64X console, this is log from the GEL scripts.
      Select AM64X GEL Console

AM64X Console GEL Log
  • For success, all the three consoles should have no errors in their logs.
  • If the script is run without providing power to the EVM or if the EVM BOOTMODE is not set to NOBOOT MODE then you will see errors in the console and/or unexpected behaviour and error messages.
    • SOLUTION: Power cycle EVM and repeat the steps.

BOOT MODE

UART BOOT MODE

This mode is used to flash files to the EVM flash via UART. It can also be used to boot applications via UART.

BOOTMODE [ 0 : 7 ] (SW2) = 1101 1100
BOOTMODE [ 8 : 15 ] (SW3) = 1011 0000

UART BOOT MODE

OSPI BOOT MODE

This mode is used to boot flashed applications via EVM flash like OSPI flash

BOOTMODE [ 0 : 7 ] (SW2) = 1100 1110
BOOTMODE [ 8 : 15 ] (SW3) = 0100 0000

OSPI BOOT MODE

SD BOOT MODE

This mode is used to boot applications via SD card on the EVM.

BOOTMODE [ 0 : 7 ] (SW2) = 1100 0011
BOOTMODE [ 8 : 15 ] (SW3) = 0110 1100

SD BOOT MODE
Note
Booting user applications from SD card is not yet supported. Use this only as part of SOC Initialization Using SD BOOT

NOBOOT MODE

This mode is used in conjunction with the load_dmsc.js script described here SOC Initialization Using CCS Scripting,

BOOTMODE [ 0 : 7 ] (SW2) = 1101 1111
BOOTMODE [ 8 : 15 ] (SW3) = 0000 0000

NO BOOT MODE