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
The DCAN 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 > dcan_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 dcan_flash_programmer folder. For a more detailed explanation on kernel functionality, refer to the CAN Flash Programming of C2000 Microcontrollers application note [16].
The following devices are supported by the dcan_flash_programmer in C2000Ware:
DCAN Flash Kernel is based off DCAN ROM loader sources. To enable this code to erase and program flash, flash APIs must be incorporated, which is done by linking the flash APIs.
Before any application data is received, the F28P65x and F280015x DCAN flash kernels erase the flash of the device readying for programming. The F28P65x and F280015x DCAN flash kernel projects allow the user to specify which flash banks and flash sectors to erase before the application is programmed. This is discussed in more detail in the CAN Flash Programming of C2000 Microcontrollers application note [16].
After the appropriate locations in flash memory are erased, the application load begins. A buffer is used to hold the received contiguous blocks of application code. When the buffer is full or a new block of non-contiguous data is detected, the code in the buffer is programmed. This continues until the entire application is received.
Before writing to a sector for the first time, the F28003x DCAN flash kernel checks to see if the sector has been erased. If the sector has not been erased, then the F28003x Flash kernel has the Flash API execute an erase operation. After this, a buffer is filled up with content to be written into Flash, and 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.
After the DCAN module is initialized in the flash kernel, this module waits for the host to send in the firmware image. The flash kernel receives 8 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.
All of the sections of the firmware image stored in flash are aligned according to the number of bits being programmed at once.
Flash kernel source and project files for CCS are provided in C2000Ware, in the examples directory of the corresponding 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 DCAN 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 boot option 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 dcan_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 boot mode. If the user needs to load code from an external host in the on-chip flash, then users can either use the default BMSPs, if supported, to configure CAN boot or configure the BOOTPIN-CONFIG and BOOTDEF registers.
The default BMSPs to enable CAN boot can be found in the TMS320F28003x Real-Time Microcontrollers data sheet. If the user sets GPIO24 to 1 and GPIO32 to 0, then the boot ROM jumps to the CAN bootloader with CANRXA to GPIO5 and CANTXA to GPIO4 without needing to program the device registers.
However, if the user wants the flexibility of using CAN boot with different GPIO assignments, then the OTP or emulation BOOTCONFIG and BOOTDEF registers need to be configured for the specific boot option. Refer to the GPIO Assignments in the TMS320F28003x Real-Time Microcontrollers data sheet to find which CAN 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.

Now, the device needs to be set up to emulate a CAN boot with boot option 0x02, CANRXA = GPIO5 and CANTXA = GPIO4. There is only ≃10 second timeout window to send the first CAN frame to device.





Now, the CAN bootloader (with GPIO assignments as specified by the boot option 0x02) in the ROM begins executing and waits 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 > dcan_flash_programmer).
The host is responsible for sending the DCAN 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 frames on the CAN analyzer.
On the F28003x device, the clock to the CAN 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 100Kbps. The host CAN programmer configures the PEAK CAN analyzer to have the same clock and nominal bit rate value.
The host initializes the analyzer for CAN usage, sends the kernel over in 2-byte increments, and then sends over the image in 8-byte increments with a delay of 10ms 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 CAN 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 are detailed in [4].
dcan_flash_programmer.exe –d DEVICE -k KERNEL_FILE -a APPLICATION_FILE -v
dcan_flash_programmer.exe –d DEVICE_NAME –k <path_to_kernel_hex> -a <path_to_application_hex> -vThis first loads the DCAN flash kernel into RAM of the device using the bootloader. The bytes transferred over the CAN 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-30 and Figure 4-31. The kernel branches to the application and begins executing if successfully loaded into the flash.
Figure 4-30 DCAN Flash Programmer Kernel
Loaded
Figure 4-31 DCAN Flash Programmer
Application Loaded