SPNA241 August   2019 RM41L232 , RM42L432 , RM44L520 , RM44L920 , RM46L430 , RM46L440 , RM46L450 , RM46L830 , RM46L840 , RM46L850 , RM46L852 , RM48L530 , RM48L540 , RM48L730 , RM48L740 , RM48L940 , RM48L950 , RM48L952 , RM57L843 , TMS570LC4357 , TMS570LC4357-EP , TMS570LC4357-SEP , TMS570LS0232 , TMS570LS0332 , TMS570LS0432 , TMS570LS0714 , TMS570LS0714-S , TMS570LS0914 , TMS570LS10106 , TMS570LS10116 , TMS570LS10206 , TMS570LS1114 , TMS570LS1115 , TMS570LS1224 , TMS570LS1225 , TMS570LS1227 , TMS570LS20206 , TMS570LS20206-EP , TMS570LS20216 , TMS570LS20216-EP , TMS570LS2124 , TMS570LS2125 , TMS570LS2134 , TMS570LS2135 , TMS570LS3134 , TMS570LS3135 , TMS570LS3137 , TMS570LS3137-EP

 

  1.   CAN Bus Bootloader for Hercules Microcontrollers
    1.     Trademarks
    2. Introduction
    3. Hardware Requirements
    4. CAN Settings
    5. Software Coding and Compilation
    6. Exception Vector Table
    7. ECC Generation for Bootloader Code
    8. ECC Generation for Application Code
    9. During Bootloader Execution
    10. Bootloader Flow
    11. 10 CAN Bootloader Operation
    12. 11 CAN Bootloader Protocol
    13. 12 Create Application for Use With the Bootloader
    14. 13 Sample Code for PC-Side Application
    15. 14 References

CAN Bootloader Protocol

Messages between a CAN bootloader host and the target use a simple command and acknowledge (ACK) protocol. The host sends a command and within a timeout period the target responds with either an ACK or with a NACK. The command data is combined into message ID. The standard 11 bit message ID is used. Among the 11 bits, the bit 0 to bit 3 is for the bootloader commands, and bit 4 to bit 7 is used for device ID, and the bit 8 to bit 11 is used for manufacturer ID.

The CAN bootloader provides a short list of commands that are used during the firmware update operation. The definitions for these commands are provided in the file bl_commands.h. The description of each of these commands is covered in this section.

  • CAN_COMMAND_PING (0x00)
  • This command is used to receive an acknowledge command from the bootloader indicating that communication has been established. This command has no data. If the device is present, it will respond with a CAN_COMMAND_PING back to the CAN update application.

  • CAN_COMMAND_GET_ADDR_SIZE (0x01)
  • This command sets the base address for the download as well as the size of the data to write to the device. This command should be followed by a series of CAN_COMMAND_GET_ADDR_SIZE that send the actual image to be programmed to the device. The command consists of two 32-bit values. The first 32-bit value is the address to start programming data into, while the second is the 32-bit size of the data that will be sent.

    This command also triggers an erasure of the full application area in the Flash. This Flash erase operation causes the command to take longer to send the CAN_COMMAND_ACK in response to the command, which should be taken into account by the CAN update application.

    The format of the command is as follows:

    unsigned char ucData[8]; ucData[0] = Download Address [7:0]; ucData[1] = Download Address [15:8]; ucData[2] = Download Address [23:16]; ucData[3] = Download Address [31:24]; ucData[4] = Download Size [7:0]; ucData[5] = Download Size [15:8]; ucData[6] = Download Size [23:16]; ucData[7] = Download Size [31:24];
  • CAN_COMMAND_GET_DATA (0x04)
  • This command should only follow a CAN_COMMAND_GET_ADDR_SIZE command or another CAN_COMMAND_GET_DATA command when more data is needed.

    Consecutive send data commands automatically increment the address and continue programming from the previous location. The transfer size is limited to 8 bytes at a time based on the maximum size of an individual CAN transmission. The command terminates programming once the number of bytes indicated by the CAN_COMMAND_GET_ADDR_SIZE command have been received.

    The CAN bootloader sends a CAN_COMMAND_ACK in response to each send data command to allow the CAN update application to throttle the data going to the device and not overrun the bootloader with data.

    This command also triggers the programming of the application area into the Flash. This Flash programming operation causes the command to take longer to send the CAN_COMMAND_ACK in response to the command, which should be taken into account by the CAN update application.

    The LED D7 is flashing until the application update is complete.

    The format of the command is as follows:

    unsigned char ucData[8]; ucData[0] = Data[0]; ucData[1] = Data[1]; ucData[2] = Data[2]; ucData[3] = Data[3]; ucData[4] = Data[4]; ucData[5] = Data[5]; ucData[6] = Data[6]; ucData[8] = Data[7];
  • CAN_COMMAND_RESET (0x05)
  • This command is used to tell the CAN bootloader to reset the microcontroller. This is used after downloading a new image to the microcontroller to cause the new application or the new bootloader to start from a reset. The normal boot sequence occurs and the image runs as if from a hardware reset. It can also be used to reset the bootloader if a critical error occurs and the CAN update application needs to restart communication with the bootloader.

  • CAN_COMMAND_REQUEST (0x05)
  • This command returns the status of the last command that was issued. This command has no data.