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.

CCS/EK-TM4C1294XL: EK-TM4C1294XL CAN Boot-loader

Part Number: EK-TM4C1294XL


Tool/software: Code Composer Studio

I am using EK-TM4C1294XL Kit to built an application and i success to built this application but, now i need to flash my kit over can bus so i decided to use Ti bootloader  according to TivaWare™ Boot Loader Document i update Serial boot example located at "ti\TivaWare_C_Series-2.1.4.178\examples\boards\ek-tm4c1294xl\boot_serial"  to use CAN bus 0 instead of UART but i can't transmit or receive any data over this bus . below show the updates which i apply on bl_config.h file 

//*****************************************************************************
#define CAN_ENABLE_UPDATE

//*****************************************************************************

//
// 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_GPIOA

//*****************************************************************************
//
// 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_PORTA_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 0
#define CAN_RX_PIN_PCTL 7
//*****************************************************************************
//
// 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_GPIOA

//*****************************************************************************
//
// 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_PORTA_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 1
#define CAN_TX_PIN_PCTL 7
//*****************************************************************************
//
// The bit rate used on the CAN bus. This must be one of 20000, 50000, 125000,
// 250000, 500000, or 1000000. The CAN bit rate must be less than or equal to
// the crystal frequency divided by 8 (CRYSTAL_FREQ / 8).
//
// Depends on: CAN_ENABLE_UPDATE
// Exclusive of: None
// Requires: None
//
//*****************************************************************************
#define CAN_BIT_RATE 20000

  • What have you done to verify your hardware? What are you using to provide the CAN commands? This is referred to as the "CAN update application". Do you see the "LM_API_UPD_PING" command on the CAN bus lines coming from the CAN update application? If yes, do you get an acknowledge from the device running the boot loader? Do you get the answering LM_API_UPD_PING?
  • Thanks for your Reply .

    we create other CAN node"CAN programmer"  using driverlib CAN functions with the same bit timing configuration we apply at target node CAN programmer node  sent "LM_API_UPD_PING" command to the target node and wait any feedback "LM_API_UPD_PING" from target node .By monitoring this CAN bus using USB to CAN parser and we just receive "LM_API_UPD_PING" command which sent from CAN programmer node to test the communication status with target node and by debugging bootloader code flashed on target node we received nothing at target node so we can't receive any data on this node .

    we update void UpdaterCAN(void) function at bl_can.c file as following i replace ui32Cmd = PacketRead(g_pui8CommandBuffer, &ui32Bytes); line by ui32Cmd =0;  just for testing transmit function and nothing are transmit on the bus .

    waiting for you support !!!

  • Dear Bob,

    we built an application using driverlib.lib to transmit and receive data over CAN Bus 0  and it work fine and we still debug on Firmware updating over CAN bus and we apply following  

    'We adjust  the functions at CAN APP we built based on driverlib.lib and use them at  Serial-boot example and it doesn't work ".

    The Main deference between  those Previous applications is the way we use to set configuration of the main oscillator. at CAN APP we use flowing functions  

    SysCtlMOSCConfigSet(SYSCTL_MOSC_HIGHFREQ);
    
    ui32SysClock = MAP_SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ |
                        SYSCTL_OSC_MAIN |
                        SYSCTL_USE_PLL |
                        SYSCTL_CFG_VCO_480), 25000000);

    but at Serial Bootloader over can we use following 

    #ifdef CRYSTAL_FREQ
    #if defined(TARGET_IS_TM4C129_RA0) ||                                         \
    	defined(TARGET_IS_TM4C129_RA1) ||                                         \
        defined(TARGET_IS_TM4C129_RA2)
    
        //
        // Since the crystal frequency was specified, enable the main oscillator
        // and clock the processor from it. Check for whether the Oscillator range
        // has to be set and wait states need to be updated
        //
        if(CRYSTAL_FREQ >= 10000000)
        {
            HWREG(SYSCTL_MOSCCTL) |= (SYSCTL_MOSCCTL_OSCRNG);
            HWREG(SYSCTL_MOSCCTL) &= ~(SYSCTL_MOSCCTL_PWRDN | SYSCTL_MOSCCTL_NOXTAL);
        }
        else
        {
            HWREG(SYSCTL_MOSCCTL) &= ~(SYSCTL_MOSCCTL_PWRDN | SYSCTL_MOSCCTL_NOXTAL);
        }
    
        //
        // Wait for the Oscillator to Stabilize
        //
        Delay(524288);
    
        if(CRYSTAL_FREQ > 16000000)
        {
        	HWREG(SYSCTL_MEMTIM0)  = (SYSCTL_MEMTIM0_FBCHT_1_5 | (1 << SYSCTL_MEMTIM0_FWS_S) |
                    				  SYSCTL_MEMTIM0_EBCHT_1_5 | (1 << SYSCTL_MEMTIM0_EWS_S) |
                    				  SYSCTL_MEMTIM0_MB1);
        	HWREG(SYSCTL_RSCLKCFG) = (SYSCTL_RSCLKCFG_MEMTIMU | SYSCTL_RSCLKCFG_OSCSRC_MOSC);
        }
        else
        {
        	HWREG(SYSCTL_RSCLKCFG) = (SYSCTL_RSCLKCFG_OSCSRC_MOSC);
        }
    #else
        //
        // Since the crystal frequency was specified, enable the main oscillator
        // and clock the processor from it.
        //
        HWREG(SYSCTL_RCC) &= ~(SYSCTL_RCC_MOSCDIS);
    
        //
        // Delay while the main oscillator starts up.
        //
        Delay(524288);
    
        //
        // Set the crystal frequency and switch to the main oscillator.
        //
        HWREG(SYSCTL_RCC) = ((HWREG(SYSCTL_RCC) &
                              ~(SYSCTL_RCC_XTAL_M | SYSCTL_RCC_OSCSRC_M)) |
                             XTAL_VALUE | SYSCTL_RCC_OSCSRC_MAIN);
    #endif
    #endif

    are you have any idea about the reason which make the same function work at the application we built using driverlib.lib and not work with Serial-boot example . attached image shown the registers value of CAN0 at both cases we notice that registers have the same values at both cases .

    CAN_APP registers Value :

    Serial_boot CAN0 registers values:

      

    Thanks !!!

  • No, I don't know why you are seeing a different behavior. You did not mention the value of CRYSTAL_FREQ. Is it 25000000? Also, why do you use the PLL to get 25MHz when you are using a 25MHz crystal?