From HW wiki
Jump to: navigation, search
TMS570LS31x HDK Kit.jpg



Tools recommended by TI for programming of this microcontroller:

CCS5.3.0.00090_linux in Ubuntu 12.04 64bits

After installation the application can be run with:

cd <install_dir>/ccsv5/eclipse/


If the application fails to start is because CCS5 is a 32bits application a thus requires 32bits libraries:

sudo apt-get install libgtk2.0-0:i386 libxtst6:i386 gtk2-engines-pixbuf:i386 libcanberra-gtk-module:i386

If the application crashes with a segmentation fault do:

Edit <install_dir>/ccsv5/eclipse/plugins/com.ti.ccstudio.branding_<your version number>/plugin_customization.ini

And change key org.eclipse.ui/showIntro to false.

Choose "FREE License - for use with XDS100 JTAG Emulators" on the licensing options.

You may create a symbolic link and a desktop entry:

sudo ln -s <install_dir>/ccsv5/eclipse/ccstudio /usr/local/bin/ccstudio

And put in ~/.local/share/applications/ccs5.desktop

[Desktop Entry]
Name=Code Composer Studio

CCS5.5.0.00077_windows on Windows 7x64

Download ccs_setup_5.5.0.00077.exe from and run.

Choose component:

  • Safety MCUs

Choose Compiler tools:

  • TI ARM Compiler Tools
  • TI Documentation

Coose JTAG Emulator Support

  • XDS100 Class Emulator Support

NHET Assembler

Installer doesn't work under Wine (Debian unstable, wine-1.6.2) even after installing the following packages, which wine complained about: apt-get install p11-kit-modules:i386 gnome-keyring:i386

If it is installed under windows, the resulting hetp.exe runs under Wine correctly.


Installation is easy, simply create new project in HalCoGen

  • New -> Project
  • Select Family:TMS570LS31x
  • Select Device: TMS570LS3137ZWT_FREERTOS

All necessary files will be added into project automaticaly.

Matlab/Simulink Embedded Coder target

We have implemented support for Matlab/Simulink which allows to use designed peripherals support libraries from Simulink model design.

For further information look at separate pages for the target


Developement board we are using: TMS570LS31x_HDK_Kit

SDRAM setup

Setup of bit 31 in GPREG1 is required ele EMIF does not work as expected. From UM 4.3.3 Control of Special Multiplexed Options: Any application that requires the EMIF functionality must set GPREG1[31]. This allows these 8 EMIF module outputs to be driven on to the assigned balls.

systemREG1->GPREG1 |= 0x80000000;
Parameter Value for HDK / Conn test Value for RPP Notice
Chip IS42S16400F-7BL IS45S16320
banks 4 (2 bits) 4 (2 bits)
rows 4096 (12 bits) 8192 (13 bits)
columns 256 (8 bit) 1024 (10 bits)
CL 2/3 2/3
refresh [ms] 64 / 16 @ 80 °C
self. ref. exit [ns] 67
HCLK [MHz] 160 / 160 160
EMIF Clock / VCLK3 80 / 80?? 80
CLK2CNTL Clock 2 Control Register
VCLK3R (3-0) 2-1 / 4-1?? 2-1 HCKL to EMIF VCLK3 ration
SDTIMR SDRAM Timing Register
TRF_C (31-27) 6-1 / 6 9-1 REFR to REFR
T_RP (26-24) 2-1 / 1 3-1 PRE to ACTIV or REFR
(23) 0 0
T_RCD (22-20) 2-1 / 1 3-1 ACTIV to RD/WR
(19) 0 0
T_WR (18-16) 2-1 / 2 2-1 WRITE to PRE
T_RAS (15-12) 4-1 / 4 6-1 ACTIV to PRE
T_RC (11-8) 6-1 / 3 9-1 ACTIV to ACTIV
(7) 0 / 0 0
T_RRD (6-4) 2-1 / 1 2-1 ACTIV to ACTIV other bank
(3) 0 0
SDSRETR Self Refresh Exit Timing Register
T_XS (XSR) 5 / 6 5+3-1
RR (12-0) 312 / 1250 156 80e6 * 16e-3 / 8192 => less or equal to 156
SDCR SDRAM Configuration Register
SR (31) 0 / 0 0 self refresh mode
PD (30) 0 / 0 0 power down
PDWR (29) 0 / 0 0 refresh in PD
NM (14) 1 / 1 1 narrow mode
CL (11-9) 2 / 3 3 CAS latency
BIT11_9LOCK (8) 1 / 1 1 CAS latency lock
IBANK (6-4) 2 / 2 2 (4 banks) banks
PAGESIZE (2-0) 0 / 0 2 (10 bit) counted in elements

SCI port

We have connected serial port on Expansion Connector P3 (see HDK documentation) pin W3 and N2. TX is connected to N2 pin and RX to W3 pin. This brings us consequences as both pins are mutexed.

When you want to use SCI, you have to set few things in HalCoGen.

  • Enable driver SCI (not LIN or SCI2 driver) base = 0xfff7e500
  • On RPP board SCILIN is is used for terminal connection base = 0xfff7e400
  • In tab PINMUX select SCI and check conflict with other drivers
  • In tab SCI choose and set data format.

When you want use interrupts in addition, do the following:

  • In tab VIM Channel 64-95 select interrupt 64: SCI level0 interrupt for high level interrupt or 74: SCI Level1 for low level interrupt
  • In SCI tab enable TX and/or RX interrupt and select High or Low.
  • In your code enable IRQ using _enable_IRQ() function, than enable notification using sciEnableNotification() function.
  • Implement notification callback sciNotification() in notificatin.c

In your code don't forget to initialize sci using sciInit() function.

Debug over JTAG

XDS100v2 JTAG Interface from Ti

The XDS100v2 is equipped with Ti specific 14-pin JTAG connector. Next cable wires placement allows to use it with TMS570LS31x_HDK_Kit or other device with ARM JTAG pin placement.

14 pin Ti 20 pin ARM
5 VD VREF 1 (2)
6 NC --
7 TDO TDO 13
8 GND GND (4)
10 GND GND 8 (12)
11 TCK TCK 9
12 GND GND 10 (14)
13 EMU0
14 EMU1

Setup XDS100v2 on Linux

By default the device (if nothing more connected then /dev/ttyUSB0) is added with permissions 664 with root as user and group. You access the device we need write access for current user. To do so we need to create a new udev rules:

sudo nano /etc/udev/rules.d/45-pes-rpp.rules

And add line:

SUBSYSTEM=="usb", ATTR{idVendor}=="0403", ATTR{idProduct}=="a6d0", MODE="0660", GROUP="plugdev"

Then reload udev rules with:

sudo udevadm control --reload-rules

You can check device properties like idVendor or idProduct with the following command:

udevadm info -a -p $(udevadm info -q path -n /dev/ttyUSB0)

OpenOCD setup and Flashing

Consult FTDI2232_JTAG page for generic OpenOCD setup for ARM targets debugging.

The OpenOCD TMS570 Flash support developed by Andrey Smirnov can be found in OpenOCD Gerrit

Patches with our corrections to the support have been sent to the OpenOCD mailing-list. The complete OpenOCD sources with all required patches applied (openocd-tms570-f021-wip.tar.gz) can be found at temporal place

As a base for OpenOCD configuration for the TMS570 target can be used

The example of Flash erase and write OpenOCD commands

flash banks
flash list
# probe bank/target for actual flash size
flash probe 0
# updated information about banks
flash banks

# erase one 128kB sector starting at 1MB
flash erase_address 0x00100000 0x00020000

# test Flash write using fill pattern
flash fillw 0x00100000 0xabcd1234 128
# Check memory content 
mdw 0x00100000 256

Program application starting at zero address

# probe bank/target for actual flash size
flash probe 0

# Erase the first 256kB of Flash 
flash erase_address 0x00000000 0x00040000

# Program application
program application.elf

Program binary image starting at 256kB boundary and maximal length 1MB

# probe bank/target for actual flash size
flash probe 0

# Erase the area after the first 256kB of Flash 
flash erase_address 0x00040000 0x00100000

# Program application
program application.bin 0x00040000

RS232 communication setup

Connect serial communication pins to computer's RS232 port or to USB through a FTDI adapter. If using RS232 port the device should be /dev/ttyS0, if using FTDI it should be something like /dev/ttyUSBx (check dmesg for details).

Make sure minicom or similar terminal program is installed:

sudo apt-get install minicom

Then configure minicon:

sudo minicom -s

And use the following configuration "9600 81N":

Serial Device         : /dev/ttyS0
Lockfile Location     : /var/lock
Callin Program        :
Callout Program       :
Bps/Par/Bits          : 9600 8N1
Hardware Flow Control : No
Software Flow Control : No

Start terminal session and type HELP command to test communication.

GCC build for Cortex-R4 Big-Endian

GCC options
-mbig-endian -march=armv7-r -mthumb
GCC options with hard float
-mbig-endian -mthumb -march=armv7-r -mfpu=vfpv3-d16 -mfloat-abi=hard

GCC multilib options


RTEMS Cortex-R4 TMS570 BSP Deveopment (GSoC 2014 project)