LAUNCHXL-F28P55X: Documentation & examples related to CAN Standard configuration using SYS CONFIG

Part Number: LAUNCHXL-F28P55X
Other Parts Discussed in Thread: SYSCONFIG, C2000WARE

Tool/software:

Hello,

Can anyone please send across documentation & examples related to CAN Standard configuration using SYS CONFIG. I use  CCS 20.1.1 IDE & sysconfig ver C2000Ware_6_00_00_00

I see only manual configuration examples in listed in CCS 20.1.1.

Somebody Please help!

Regards,

Sharath

  • HI Sharath,

    Just imported two F28P55x MCAN example projects from C2000Ware_6x, the projects contain the the sysconfig file: c2000.syscfg:

  • Hello,

    Thanks for the quick response. 

    Before proceeding further, I want to clear one point. What I meant in my earlier message was that I am able to generate C2000.syscfg, but none of the project I see where CAN is configured using syscfg, instead all example projects (related to CAN) were configured using manual code & not syscfg auto generated code.

    I hope you can get to know my query clearly by my above message. Please help!

    Regards,

    Sharath

  • I understood your question. It's very straightforward to use the sysconfig generated driver. 

    Call the following functions in your main() function:

    1. Board_Init(),

    2.  Device_initGPIO()

    and  SysCtl_setMCANClock(...)

  • Just as a reference. It is not tested.
    //
    // Include Files
    //
    #include "board.h"
    
    void main()
    {
        MCAN_TxBufElement   txMsg;
    
        //
        // Initialize device clock and peripherals
        //
        Device_init();
    
        //
        // Initialize GPIO and unlock the GPIO configuration registers
        //
        Device_initGPIO();
    
        //
        // Configure the divisor for the MCAN bit-clock
        //
        SysCtl_setMCANClk(SYSCTL_MCANA, SYSCTL_MCANCLK_DIV_5);
    
        //
        // Board initialization
        //
        Board_init();
    
        //
        // Initialize message to transmit.
        //
        //
        // Initialize message to transmit.
        //
        txMsg.id       = ((uint32_t)(0x4)) << 18U; // Identifier Value.
        txMsg.rtr      = 0U; // Transmit data frame.
        txMsg.xtd      = 0U; // 11-bit standard identifier.
        txMsg.esi      = 0U; // ESI bit in CAN FD format depends only on error
                             // passive flag.
        txMsg.dlc      = 4U; // CAN + CAN FD: transmit frame has 0-8 data bytes.
        txMsg.brs      = 1U; // CAN FD frames transmitted with bit rate
                             // switching.
        txMsg.fdf      = 1U; // Frame transmitted in CAN FD format.
        txMsg.efc      = 1U; // Store Tx events.
        txMsg.mm       = 0xAAU; // Message Marker.
    
        //
        // Data bytes.
        //
        txMsg.data[0]  = 0x12;
        txMsg.data[1]  = 0x34;
        txMsg.data[2]  = 0x56;
        txMsg.data[3]  = 0x78;
    
        //
        // Write Tx Message to the Message RAM.
        //
        MCAN_writeMsgRam(myMCAN0_BASE, MCAN_MEM_TYPE_BUF, 1U, &txMsg);
    
        //
        // Add request for transmission.
        //
        MCAN_txBufAddReq(myMCAN0_BASE, 1U);
    
        //
        // Wait for the transmission to be complete
        //
        while(MCAN_getTxBufReqPend(myMCAN0_BASE))
        {
            ;
        }
    
        //
        // Stop Application.
        //
        ESTOP0;   
    
    }
    
    
  • Hello,

    Thanks for the response. Don't you think Board_Init() & other dependent functions were supposed to be added automatically by compiler or any tool itself?

    Regards,

    Sharath