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
Hello,
Thanks for reaching out to Renesas Community.
What does 'R_CAN_SetConfig' return ?
Please find the documentation of RS-CANFD module:
https://www.renesas.com/us/en/document/apn/rl78f24-rs-canfd-lite-module-software-integration-system
and application note on configuration, transmission, reception of CAN:
https://www.renesas.com/us/en/document/apn/rl78f24-rs-canfd-lite-configuration-reception-and-transmission-rev100?r=1552481
Could you share some of your initialization code?
Regards
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 =4tx.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){}}
RAM initialization ,global mode and channel mode conversion to global reset mode and channel reset mode cannot be achieved .
What is the return value of 'R_CAN_SetConfig' ?
Above mentioned error is corrected .I faced problem in program debugging .Thank you for your response
Ok thanks, good to know.
Hi Nish
Now Can transmit is working for you ?