RL78/F24 -RS CAN FD configuration

Hi ,

I am facing problem in CAN configuration. After basic configuration in Smart configurator ,I generated code in CS+ IDE.. After calling api function R_CAN_Create(),R_CAN_SetConfig()

the conversion of global,channel mode from sleep mode to reset mode condition fails. Is there any methods to configure the global,channel modes? .Can I get the sample code for CAN

configuration and transmission .

Thanking you

Parents Reply
  • This is the program  I tried for CAN transmission.

    I referred the documents mentioned above ,R_CAN_SetConfig() does contain the global setting and the different mode setting of CAN.This functions checks if the global,channel mode from sleep mode is converted to reset mode if true the configuration like communication speed ,rx rule etc is done , but in my case the mode conversion condition is false .


    #include "r_rscanfd_rl78_if.h"
    #include "r_rscanfd_rl78_config.h"
    #include "r_rscanfd_rl78_private.h"

    void main(void);

    st_can_tx_frame_t tx;
    volatile uint32_t result,a;
    void main(void)
    {

    //tx header
    tx.Head.Bits.ID=123;
    tx.Head.Bits.THLEN=0;  //tx history not stored
    tx.Head.Bits.RTR=0;//data frame
    tx.Head.Bits.IDE=0; //std frame
    tx.Head.Bits.DLC=8; //data lenfth code =4
    tx.Head.Bits.FDCTR=0X6; //NO ESI used
    tx.Head.Word[0]=4;  //word access    

    tx.Data.DB[0]=1;

    /*start api func*/
    R_CAN_Create();
    R_CAN_SetConfig();
    R_CAN_StartComm();
    R_CAN_SendByTXMB(CAN_TXBUF0,&tx);
    result=R_CAN_GetTXMBResult( CAN_TXBUF0);

    while(1)
    {
    }

    }

Children
No Data