This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TM4C123GH6PM: Firmware upgradation of TM4C123GH6PM through CAN

Part Number: TM4C123GH6PM
Other Parts Discussed in Thread: EK-TM4C123GXL

Hi,

I am using boot_serial example provided by TI to upgrade the firmware using CAN. Can you please answer the following queries

1. What changes i have to make in the boot_serial example code for using it with CAN communication

2. How to test if the bootloader is working with CAN communication (How to send application binary file using CAN bootloader)

3. What is the use of CAN_UART_BRIDGE. Do we need to use this for CAN bootloader code?

4. How to jump from application to bootloader for application directed firmware upgrade.

Thank you

Best Regards

  • First, I need to admit that I do not have experience with the CAN bootloader. We may need to work through this together.

    Dipin P K said:
    What changes i have to make in the boot_serial example code for using it with CAN communication

    I made the following edits to the bl_config.h file:

    1. Line 359, comment out

    //#define UART_ENABLE_UPDATE
    

    2. Remove the comment "//" from line 1281, and edit to match the GPIO port of the CAN0 RX pin used

    3. Remove the comment "//" from line 1294 and edit to match the GPIO port of the CAN0 RX pin used

    4.  Remove the comment "//" from line 1306 and edit to match the pin number of the RX pin used

    5. Remove the comment "//" from line 1320, and edit to match the GPIO port of the CAN0 TX pin used

    6. Remove the comment "//" from line 1333and edit to match the GPIO port of the CAN0 TX pin used

    7.  Remove the comment "//" from line 1345 and edit to match the pin number of the TX pin used

    8. Remove the comment "//" from line

    I also had to add two defines (not sure why they were not already in bl_config.h)

    #define CAN_RX_PIN_PCTL         8
    #define CAN_TX_PIN_PCTL         8
    

    The value is equal to the alternate function value of the CAN0 RX and TX pins used. In my example I used PE4 fro RX and PE5 for TX.

    Dipin P K said:
    How to test if the bootloader is working with CAN communication (How to send application binary file using CAN bootloader)

    Unless you already have a tool that generates the necessary CAN commands, you can build another project using "CAN_UART_BRIDGE". When this is defined, instead of building a bootloader the project builds an application that translates serial bootloader commands into CAN bootloader commands (and vice versa). You use LM Flash Programmer on a PC talking to a device that acts as the UART CAN bridge. This device then talks to your CAN bus to program the other devices on the CAN bus.

    Dipin P K said:
    What is the use of CAN_UART_BRIDGE. Do we need to use this for CAN bootloader code?

    Hopefully the answer is explained in the question above.

    Dipin P K said:
    How to jump from application to bootloader for application directed firmware upgrade

        //
        // Return control to the boot loader.  This is a call to the SVC
        // handler in the boot loader.
        //
        (*((void (*)(void))(*(uint32_t *)0x2c)))(); 
    

  • Thank You Very much for your quick response and valuable suggestions Bob.

    I have modified the code for working with CAN communication.

    I am using Emtas CANopen Device Explorer tool for generating CAN command as of now. But I am unable to find an option to send the application binary file(.bin) using the same tool. If you have any suggestions please help me on that.

    Do we have any other tool to send the binary file through CAN communication?

    My designed board has only CAN communication to the external world. So I can not use CAN_UART_BRIDGE and LM Flash Programmer for CAN bootloader (Its my understanding. Correct me if I am wrong)

    And I have one more question not related to this problem. And this is just because of my curiosity.

    In LM Flash Programmer why we need to specify the Program Address Offset as it is already available in th bootloader code as APP_START_ADDRESS ? 

    Thank You

    Best Regards

  • Have you considered using an EK-TM4C123GXL Launchpad as the CAN_UART_BRIDGE between the PC UART and your custom board?

    Dipin P K said:
    In LM Flash Programmer why we need to specify the Program Address Offset as it is already available in the bootloader code as APP_START_ADDRESS ? 

    The APP_START_ADDRESS is the location the boot-loader checks to see if a valid application already exists in the flash. While it is often the start of the first block of data to program, it is not always the case. Also, APP_START_ADDRESS can be changed for different versions of the boot-loader.

  • I am interested to test the CAN bootloader using "CAN_UART_BRIDGE" . But I am not understanding how to configure "CAN_UART_BRIDGE" in the code and make it work with LM Flash Programmer. Can you please explain me the procedure to do that.

    I have removed the comment "//" from #define CAN_UART_BRIDGE already in bl_config.h file

    Thanks in advance

    Regards

  • I did some more digging into the CAN UART Bridge code and see that it does not use the same serial protocol as LM Flash programmer (it is a very old example). I will look at this in more details over the holidays and hope to be able to post a working solution.
  • Is there any other option to test the CAN Bootloader code. (as CAN UART bridge does not work with LM Flash programmer)

    Waiting for your response.

    Thanks in advance.

  • I have no other suggestions at this time. Unfortunately I was not able to work on a solution over the holidays.