SPRAD51A December   2023  – April 2024 F29H850TU , F29H859TU-Q1 , TMS320F2800157 , TMS320F280039 , TMS320F280039-Q1 , TMS320F280039C , TMS320F280039C-Q1 , TMS320F28P659DK-Q1

 

  1.   1
  2.   Abstract
  3.   Trademarks
  4. 1Introduction
  5. 2Programming Fundamentals
  6. 3ROM Bootloader and Hex Utility Usage
  7. 4DCAN Flash Kernel
    1. 4.1 Implementation
      1. 4.1.1 Custom Flash Bank and Sector Erase
      2. 4.1.2 Application Load
  8. 5MCAN Flash Kernel
    1. 5.1 Implementation
      1. 5.1.1 Custom Flash Bank and Sector Erase
      2. 5.1.2 Application Load
  9. 6Example Implementation
    1. 6.1 Device Setup
      1. 6.1.1 Flash Kernels
      2. 6.1.2 Hardware
    2. 6.2 Host Application: dcan_flash_programmer
      1. 6.2.1 Overview
      2. 6.2.2 Building and Running dcan_flash_programmer Using Visual Studio
      3. 6.2.3 Running dcan_flash_programmer for F28003x
      4. 6.2.4 Using the Project With DCAN Bootloader
      5. 6.2.5 Using the Project With CCS
    3. 6.3 Host Application: can_flash_programmer [MCAN]
      1. 6.3.1 Overview
      2. 6.3.2 Building and Running can_flash_programmer Using Visual Studio
      3. 6.3.3 Running can_flash_programmer for F28003x
      4. 6.3.4 Using the Project With MCAN Bootloader
      5. 6.3.5 Using the Project With CCS
    4. 6.4 Application Load: CPU2 Image
      1. 6.4.1 Combining Two Images (.txt)
  10. 7Troubleshooting
    1. 7.1 General
    2. 7.2 DCAN Boot
    3. 7.3 MCAN Boot
  11. 8References
  12. 9Revision History

ROM Bootloader and Hex Utility Usage

At the beginning of device startup, the device boots and, based on the boot mode, decides if it should execute code already programmed into the Flash memory or load in code using one of the ROM loaders. This application note focuses on the boot execution path when the emulator (CCS) is not connected.

Note: This section is based on the TMS320F28003x device. Specific information for a particular device can be found in the Boot ROM chapter of the device-specific technical reference manual (TRM).
Table 3-1 Default Boot Modes for F28003x Devices
Boot Mode GPIO24 (default boot mode select pin 1) GPIO32 (default boot mode select pin 0)
Parallel I/O 0 0
SCI/Wait boot 0 1
CAN 1 0
Flash 1 1

After the boot ROM readies the device for use, it decides where it should start executing (flash or Boot ROM). In the case of a standalone boot, it does this by examining the state of two GPIOs (as seen in Table 3-1, the default choices are GPIO 24 and 32). In some cases, two values programmed into one time programmable (OTP) memory can be examined. In the implementations described in this application note, both the CAN and MCAN loader are used, so at power up GPIO 32 must be forced low and GPIO 24 must be forced high. If this is the case when the device boots, the CAN loader in ROM begins executing and waits to receive data from the host.

For CAN Boot mode (DCAN), the boot table for GPIO assignments is defined by Table 3-2. Table 3-3 shows the MCAN Boot Options. Note that the boot options for DCAN and MCAN use the same GPIO assignments to select the boot definition value. The common GPIO pairs are GPIO4 and GPIO5, as well as GPIO13 and GPIO12. For more information, read the boot options in the device-specific TRM.

Table 3-2 CAN Boot Options
Option BOOTDEF Value CANTXA GPIO CANRXA GPIO
0 (default) 0x02 GPIO4 GPIO5
1 0x22 GPIO32 GPIO33
2 0x42 GPIO2 GPIO3
3 0x62 GPIO13 GPIO12
Table 3-3 MCAN Boot Options
Option BOOTDEFx Value CANTXA GPIO CANRXA GPIO
0 0x08 GPIO4 GPIO5
1 0x28 GPIO1 GPIO0
2 0x48 GPIO13 GPIO12

The ROM loader requires data to be presented to it in a specific structure. The structure is common to all ROM loaders and is described in detail in the Bootloader Data Stream Structure section of [6] . You can easily generate your application in this format by using the hex2000 utility included with the TI C2000 compiler. This file format can even be generated as part of the Code Composer Studio build process by adding a post-build step with the following options:

"${CG_TOOL_HEX}" "${BuildArtifactFileName}" -boot -sci8 -a -o "${BuildArtifactFileBaseName}.txt"

Alternatively, you can use the TI hex2000 utility to convert COFF and EABI .out files into the correct boot hex format. To do this, you need to enable the C2000 Hex Utility under Project Properties. The command is below:

hex2000.exe -boot -sci8 -a -o <file.txt> <file.out>

As stated before, ROM loaders can only load code into RAM, which is why they are used to load in flash kernels, which will be described in DCAN Flash Kernel and MCAN Flash Kernel sections.

The flash kernel expects the firmware image to be in the same format, so the command above can be used for the firmware image hex file generation as well.

The MCAN ROM bootloader has three boot options and each option is mapped to different GPIO pins to be used for MCANRX and MCANTX functions. In order to configure the device for MCAN Boot Mode, the OTP of the device needs to be programmed to include MCAN Boot. For more details on how to program the one time programmable (OTP), see the Boot ROM chapter of the TMS320F28003x Real-Time Microcontrollers Technical Reference Manual (TRM).