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.

TM4C123 CANbus Bootloader

Other Parts Discussed in Thread: TM4C123GH6PM

Anyone had success building the CAN bootloader for TM4C123 ?

Also, any more information on CAN-UART bridging ?

My application requires one TM4C123 to take bootloader commands from UART and dispatch these to one or more additional TM4C123's via CANbus.

Any help would be much appreciated.

Craig

  • Hi Craig,

    Tivaware has sample code for CAN bootloader. If you want to use UART to CAN bridge, just define it in bl_config.h
    #define CAN_UART_BRIDGE

    Regards,
    QJ
  • Hi QJ,

    My bootloader is derived from TivaWare_C_Series-2.1.3.156\examples\boards\dk-tm4c123g\boot_serial.

    I have built the boot_serial (using UART5) and this is working well.

    I have now configured bl_config.h for CAN. This will not build:-

    Description    Resource    Path    Location    Type
    #20 identifier "CAN_RX_PIN_PCTL" is undefined    bl_can.c    /AR_PMC_BL_CAN0_v1.00/boot_loader    line 1398    C/C++ Problem
    Description    Resource    Path    Location    Type
    #20 identifier "CAN_TX_PIN_PCTL" is undefined    bl_can.c    /AR_PMC_BL_CAN0_v1.00/boot_loader    line 1398    C/C++ Problem

    Can you provide a link to a working CAN bootloader ?

    I assume if I define CAN_UART_BRIDGE, incoming UART packets will be forwarded to the CAN controller (and vice-versa) ?

    Regards,

    Craig

  • Hello Craig,

    The Mux control value for the CAN TX and RX pin must be declared in the bl_config.h. The mux value is the value in (_) in the Signal description section of CAN chapter.

    Regards
    Amit
  • Hello Craig,

    Have you been able to resolve the issue?

    I am having the same problem to configure bootloader to work over CANbus.

    #20 identifier "CAN_RX_PIN_PCTL" is undefined bl_can.c
    #20 identifier "CAN_TX_PIN_PCTL" is undefined bl_can.c

    I cannot find any examples or references that defines this macro. I searched the whole TivaWare source tree looking for this macro.

    Any hints would be much appreciated.
  • Hi Sergie,


    Yes - I have resolved the issue.

    My bootloader uses CAN0.

    I have included an extract from my configuration (bl_config.h) below.

    Of interest to you are these definitions:

    #define CAN_RX_PIN_PCTL 8
    #define CAN_TX_PIN_PCTL 8

    These values are found in the TM4C123GH6PM datasheet.



    //*****************************************************************************
    //
    // The GPIO module to enable in order to configure the CAN0 Rx pin. This will
    // be one of the SYSCTL_RCGC2_GPIOx values, where “x” is replaced with the port
    // name (such as B). The value of “x” should match the value of “x” for
    // CAN_RX_PORT.
    //
    // Depends on: CAN_ENABLE_UPDATE
    // Exclusive of: None
    // Requires: None
    //
    //*****************************************************************************
    #define CAN_RX_PERIPH SYSCTL_RCGC2_GPIOB

    //*****************************************************************************
    //
    // The GPIO port used to configure the CAN0 Rx pin. This will be one of the
    // GPIO_PORTx_BASE values, where “x” is replaced with the port name (such as
    // B). The value of “x” should match the value of “x” for CAN_RX_PERIPH.
    //
    // Depends on: CAN_ENABLE_UPDATE
    // Exclusive of: None
    // Requires: None
    //
    //*****************************************************************************
    #define CAN_RX_PORT GPIO_PORTB_BASE

    //*****************************************************************************
    //
    // The GPIO pin that is shared with the CAN0 Rx pin. This is a value between 0
    // and 7.
    //
    // Depends on: CAN_ENABLE_UPDATE
    // Exclusive of: None
    // Requires: None
    //
    //*****************************************************************************
    #define CAN_RX_PIN 4

    //*****************************************************************************
    //
    // Selects the port control value for the GPIO corresponding to CAN RX pin
    //
    // Depends on: CAN_ENABLE_UPDATE
    // Exclusive of: None
    // Requires: CAN_RX_PIN
    //
    //*****************************************************************************
    #define CAN_RX_PIN_PCTL 8

    //*****************************************************************************
    //
    // The GPIO module to enable in order to configure the CAN0 Tx pin. This will
    // be one of the SYSCTL_RCGC2_GPIOx values, where “x” is replaced with the port
    // name (such as B). The value of “x” should match the value of “x” for
    // CAN_TX_PORT.
    //
    // Depends on: CAN_ENABLE_UPDATE
    // Exclusive of: None
    // Requires: None
    //
    //*****************************************************************************
    #define CAN_TX_PERIPH SYSCTL_RCGC2_GPIOB

    //*****************************************************************************
    //
    // The GPIO port used to configure the CAN0 Tx pin. This will be one of the
    // GPIO_PORTx_BASE values, where “x” is replaced with the port name (such as
    // B). The value of “x” should match the value of “x” for CAN_TX_PERIPH.
    //
    // Depends on: CAN_ENABLE_UPDATE
    // Exclusive of: None
    // Requires: None
    //
    //*****************************************************************************
    #define CAN_TX_PORT GPIO_PORTB_BASE

    //*****************************************************************************
    //
    // The GPIO pin that is shared with the CAN0 Tx pin. This is a value between 0
    // and 7.
    //
    // Depends on: CAN_ENABLE_UPDATE
    // Exclusive of: None
    // Requires: None
    //
    //*****************************************************************************
    #define CAN_TX_PIN 5

    //*****************************************************************************
    //
    // Selects the port control value for the GPIO corresponding to CAN TX pin
    //
    // Depends on: CAN_ENABLE_UPDATE
    // Exclusive of: None
    // Requires: CAN_TX_PIN
    //
    //*****************************************************************************
    #define CAN_TX_PIN_PCTL 8

    Hope this helps.

    Regards,

    Craig Anderson.

    On 24 April 2017 at 02:03 Sergei Karinov <bounce-4710442@mail.e2e.ti.com> wrote:

     

    A Message from the TI E2E™ Community
    Texas Instruments

     

    Sergei Karinov replied to TM4C123 CANbus Bootloader.

    Hello Craig,

    Have you been able to resolve the issue?

    I am having the same problem to configure bootloader to work over CANbus.

    #20 identifier "CAN_RX_PIN_PCTL" is undefined bl_can.c
    #20 identifier "CAN_TX_PIN_PCTL" is undefined bl_can.c

    I cannot find any examples or references that defines this macro. I searched the whole TivaWare source tree looking for this macro.

    Any hints would be much appreciated.

     

     

     

     

    You received this notification because you subscribed to the forum.  To unsubscribe from only this thread, go here.

    Flag this post as spam/abuse.


     

  • Hi Craig,

    Thank you very much for detailed response. It was very helpful.