SPRUJH3 April 2025 TMS320F2800132 , TMS320F2800133 , TMS320F2800135 , TMS320F2800137 , TMS320F2800152-Q1 , TMS320F2800153-Q1 , TMS320F2800154-Q1 , TMS320F2800155 , TMS320F2800155-Q1 , TMS320F2800156-Q1 , TMS320F2800157 , TMS320F2800157-Q1 , TMS320F280021 , TMS320F280023 , TMS320F280023C , TMS320F280025 , TMS320F280025C , TMS320F280034 , TMS320F280036-Q1 , TMS320F280036C-Q1 , TMS320F280037 , TMS320F280037C , TMS320F280038-Q1 , TMS320F280038C-Q1 , TMS320F280039 , TMS320F280039C , TMS320F280040-Q1 , TMS320F280040C-Q1 , TMS320F280041 , TMS320F280041C , TMS320F280045 , TMS320F280048-Q1 , TMS320F280048C-Q1 , TMS320F280049 , TMS320F280049C , TMS320F28076 , TMS320F28374D , TMS320F28374S , TMS320F28375D , TMS320F28375S , TMS320F28376D , TMS320F28376S , TMS320F28377D , TMS320F28377S , TMS320F28378D , TMS320F28378S , TMS320F28379D , TMS320F28379S , TMS320F28384D , TMS320F28384S , TMS320F28386D , TMS320F28386S , TMS320F28388D , TMS320F28388S , TMS320F28P550SG , TMS320F28P550SJ , TMS320F28P559SG-Q1 , TMS320F28P559SJ-Q1 , TMS320F28P650DH , TMS320F28P650DK , TMS320F28P650SH , TMS320F28P650SK , TMS320F28P659DH-Q1 , TMS320F28P659DK-Q1 , TMS320F28P659SH-Q1
ROM bootloaders can only load code into RAM, which is why ROM bootloaders are used to load in flash kernels to allow code to be stored in the flash, as described in Section 3.2. The CAN flash kernel is based on the ROM bootloader, communicating with the host PC application provided in C2000Ware (C2000Ware_x_xx_xx_xx > utilities > flash_programmers > can_flash_programmer) and providing feedback to the host on the receiving of packets and completion of commands given. The source and executable for the host application are found in the can_flash_programmer folder. For more information on kernel functionality, refer to the CAN Flash Programming of C2000 Microcontrollers application note [16].
The following devices are supported by the can_flash_programmer in C2000Ware:
The term MCAN, MCAN flash kernels, CAN flash programmer, and so forth refer to the Modular Controller Area Network (MCAN) in this document. MCAN is an interchangeable term with Controller Area Network Flexible Data-Rate (CAN-FD) [15]. The CAN flash programmer described in this document refers to the MCAN module.
The flash kernel project is modeled after the MCAN ROM bootloader. This goes straight into the MCAN_Boot function which has been modified to write to Flash. The MCAN module initialization for the flash kernel is the same as the bootloader. The clock source for the MCAN module, the nominal and data bit rates, GPIO pins, and so forth, are set by the kernel on initialization according to the boot mode.
Before any application data is received, the F28P55x kernel erases the flash of the device, readying for programming. Additionally, the F28P55x MCAN flash kernel project allows the user to specify which flash banks and flash sectors to erase before the application is programmed. This is described in more detail in the Custom Flash Bank and Sector Erase section of the CAN Flash Programming of C2000 Microcontrollers application note [16].
The F28003x kernel checks each flash sector if the flash sector been erased before programming the application. If the flash sector is has not been previously erased, then the sector is erased and the application data is written.
The F28P65x kernel erases the flash at the beginning of the application download process. Erasing flash can take a few seconds. Note, that while the application load presents as failed, the flash is being erased.
After the appropriate locations in flash memory are erased, the application load begins. The flash kernel receives 64 bytes at a time from the host and places the contents into an intermediate RAM buffer. This buffer is then written into Flash in 128-bit or 512-bit increments.
After the RAM buffer is filled up with content to be written into Flash, a program command is sent from the Flash API. Once the write has occurred, the Flash kernel has the Flash API verify that the segment was written into Flash at the correct address. Once the kernel has copied everything to Flash, the project jumps to the entry address of the image.
All of the sections of the firmware image stored in flash must be aligned according to the number of bits being programmed at once.
The protocol used to transfer the application data follows the MCAN ROM loader protocol. With the original MCAN ROM loader protocol, nominal bitrate used is 1Mbps and transmits 64 bytes per frame from the host to the target device for nominal bit timing. The data bitrate used by the protocol is 2Mbps for data bit timing.
Flash kernel source and project files for CCS are provided in C2000Ware in the corresponding examples directory of the device. These projects have a post-build step in which the compiled and linked .out file is converted into the correct boot hex format needed by the MCAN ROM bootloader and is saved as the project name with a txt extension.
The correct GPIO assignments needed for CAN routing in the LaunchPad can be confirmed by inspecting the schematics for the CAN Transceiver and Connector in C2000Ware_x_xx_xx_xx > boards > (LaunchPads or controlCARDs) > DEVICE_NAME > Rev# > documentation. On LAUNCHXL-F280039C, the transceiver RXD is internally routed to GPIO5 and TXD to GPIO4, hence BOOTDEF 0x02 needs to be configured.



After building the kernel and firmware projects in CCS, set up the device hardware correctly to be able to communicate with the host PC running the can_flash_programmer provided in C2000Ware. The first task to do is make sure the boot mode select pins are configured properly to boot the device to CAN-FD boot mode. If the user needs to load code from an external host in the on-chip flash, then users need to configure the BOOTPIN-CONFIG and BOOTDEF registers since this is not available as a default boot option. Refer to the GPIO Assignments in the TMS320F28003x Real-Time Microcontrollers data sheet to find which CAN-FD boot option fits the GPIO requirements.
The hardware components needed to run the examples are a C2000 device connected to a CAN transceiver and a PEAK PCAN-USB Pro FD analyzer.

The device needs to be set up to emulate a zero-pin CAN boot with boot option 0x02, CANRXA = GPIO5 and CANTXA = GPIO4. Now, the device needs to be set up to emulate a zero-pin CAN-FD boot with boot option 0x08, CANRXA = GPIO5 and CANTXA = GPIO4. Note that there is only approximately 10 seconds to send the first CAN frame to device.





Now, the MCAN bootloader (with GPIO assignments as specified by the boot option 0x08) in the ROM begins executing and waits to for a CAN frame to be transmitted from the host. At this point, the device is ready to receive code from the host.
The command line PC utility is a programming solution that can easily be incorporated into scripting environments for applications like production line programming. This was written using Microsoft Visual Studio in C++. The project and source can be found in C2000Ware (C2000Ware_x_xx_xx_xx > utilities > flash_programmers > can_flash_programmer).
The host is responsible for sending the MCAN kernel image and flash (firmware) image to the MCU. The PEAK PCAN-USB Pro FD CAN bus analyzer is used as the host. The flash programmer project is built and run on Visual Studio 2019. The host programmer uses the PCAN_Basic API from PEAK [17]. The PCAN_Basic API can be used to send and receive CAN-FD frames on the CAN analyzer.
On the F28003x device, the clock to the MCAN module is switched to the external clock source by the Boot ROM. The external clock is 20MHz in the LaunchPad and the ControlCard. The Boot ROM configures the nominal bit rate to be 1Mbps, and the data bit rate to be 2Mbps. The host CAN programmer configures the PEAK CAN analyzer to have the same clock, nominal and data bit rate values.
The host initializes the analyzer for CAN-FD usage, sends the kernel over in 64-byte increments, and sends over the image in 64-byte increments with a delay of 100ms between each frame to give the Flash API time to program the data received into Flash. Once the firmware image has been written, the host CAN programmer exits.
To use this tool to program the C2000 device, make sure that the target board has been reset and is currently in the CAN boot mode as configured above, and connected to the PEAK PCAN-USB Pro FD CAN bus analyzer. The command line usage of the tool for a single core MCAN boot is described below, where -d, -k, and -a are mandatory parameters. Verbose output can be enabled with -v. More details on the parameters of the utility is detailed in [14].
can_flash_programmer.exe –d DEVICE -k KERNEL_FILE -a APPLICATION_FILE -v
can_flash_programmer.exe –d DEVICE_NAME –k <path_to_kernel_hex> -a <path_to_application_hex> -vThis loads the MCAN flash kernel into RAM of the device using the bootloader. The bytes transferred over the MCAN bus can be seen in the terminal. Then, the kernel executes and loads and programs flash with the file specified by the ‘-a’ command line argument, as seen in Figure 4-41 and Figure 4-42. The kernel branches to the application and begins executing if successfully loaded into the flash.
Figure 4-41 MCAN Flash Programmer Kernel
Loaded
Figure 4-42 MCAN Flash Programmer
Application Loaded