Hello team,
while receiving the message on can I am coming in callback and the event is also set for the case FLEXCAN_EVENT_RX_COMPLETE:
but same I am doing for the can send it is not able to set the case FLEXCAN_EVENT_TX_COMPLETE:
event.
Can anyone please help me here,
Code :
//This function is used to send the CAN DATA
void CAN_Send_DATA ()
{
/* Set information about the data to be sent
* - Standard message ID
* - Bit rate switch enabled to use a different bitrate for the data segment
* - Flexible data rate enabled
* - Use zeros for FD padding
*/
can_buff_config_t TxbuffCfg = {
.enableFD = false,
.enableBRS = false,
.fdPadding = 0U,
.idType = CAN_MSG_ID_STD,
.isRemote = false
};
/* Configure TX buffer with index TX_MAILBOX*/
CAN_ConfigTxBuff(&can_pal1_instance, TX_MAILBOX, &TxbuffCfg);
CAN_InstallEventCallback(&can_pal1_instance, flexcan0_Callback, NULL);
TxMessage.cs = 0U;
TxMessage.id = TX_MSG_ID;
for(int i = 0; i < 8 ;i++)
{
TxMessage.data[i] = CAN_TX[i];
}
TxMessage.length = 8U;
status_t CANSendStatus;
/* Send the information via CAN */
CANSendStatus = CAN_Send(&can_pal1_instance, TX_MAILBOX, &TxMessage);
}
void InitCAN(void)
{
CAN_Init(&can_pal1_instance, &can_pal1_Config0);
/* Set information about the data
* - Standard message ID
* - Bit rate switch enabled to use a different bitrate for the data segment
* - Flexible data rate enabled
* - Use zeros for FD padding
*/
can_buff_config_t RxbuffCfg = {
.enableFD = false,
.enableBRS = false,
.fdPadding = 0U,
.idType = CAN_MSG_ID_STD,
.isRemote = false
};
/* Configure RX buffer with index RX_MAILBOX */
CAN_ConfigRxBuff(&can_pal1_instance, RX_MAILBOX, &RxbuffCfg, RX_MSG_ID);
CAN_InstallEventCallback(&can_pal1_instance, flexcan0_Callback, NULL);
CAN_Send_DATA();
CAN_Receive(&can_pal1_instance, RX_MAILBOX, &RxMessage);
Thanks in advance,
Rohit
Hi,
using CAN pal driver, there are just 2 events
CAN_EVENT_RX_COMPLETE
CAN_EVENT_TX_COMPLETE
So use those instead of FlexCAN events you referred to.
BR, Petr