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

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

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

1,257件の閲覧回数
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 件の賞賛
返信
3 返答(返信)

1,133件の閲覧回数
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 件の賞賛
返信

1,133件の閲覧回数
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 件の賞賛
返信

1,133件の閲覧回数
592314340
Contributor I

OK , I will try,thanks!

0 件の賞賛
返信