why S32K146: different can_id data can't send withhe same mailbox ,the code is below

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

why S32K146: different can_id data can't send withhe same mailbox ,the code is below

875 Views
592314340
Contributor I

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;
}

0 Kudos
3 Replies

751 Views
PetrS
NXP TechSupport
NXP TechSupport

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

0 Kudos

751 Views
moran_tony
Contributor I

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?

0 Kudos

751 Views
592314340
Contributor I

OK , I will try,thanks!

0 Kudos