while(txnum<5&&result1==STATUS_ERROR) //20200327
{
result1 = CAN0SendData(16, 0x1a, canCom0_recvBuff14.data, 8UL); //220200326
txnum++;
}
// if(result1==!STATUS_SUCCESS)
// {
// FLEXCAN_DRV_AbortTransfer(INST_CANCOM1, 16);
// }
txnum=0;
result2=STATUS_ERROR;
while(txnum<5&&result2==STATUS_ERROR)
{
result2 = CAN0SendData(16, 0x2a, canCom0_recvBuff14.data, 8UL); //220200326
txnum++;
}
// if(result2==!STATUS_SUCCESS)
// {
// FLEXCAN_DRV_AbortTransfer(INST_CANCOM1, 16);
// }
status_t CAN0SendData(uint32_t mailbox, uint32_t messageId, uint8_t * data, uint32_t len)
{
status_t result;
can0_tx_dataInfo.data_length =len; //20200326,send data length
/* Configure TX message buffer with index TX_MSG_ID and TX_MAILBOX*/
FLEXCAN_DRV_ConfigTxMb(INST_CANCOM1, mailbox, &can0_tx_dataInfo, messageId);
/* Execute send non-blocking */
result = FLEXCAN_DRV_Send(INST_CANCOM1, mailbox, &can0_tx_dataInfo, messageId, data); //20200326
return result;
}
Hi,
If using the same MB for transmissions, then you must be sure the MB is successfully transmitted before you are going to fill it again. So if using non-blocking functions you can use driver function FLEXCAN_DRV_GetTransferStatus in your CAN0SendData function, after driver send function is called.
/* Wait until the previous FlexCAN transmit is completed */
while(FLEXCAN_DRV_GetTransferStatus(FSL_CANCOM1, TX_MAILBOX) == STATUS_BUSY);
BR, Petr
Hello,
I am not using non-blocking functions, do you know what register and bit do I have to check and monitor to tell me if the transmit is completed?
OK , I will try,thanks!