FLEXCAN_DRV_GetTransferStatus

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

FLEXCAN_DRV_GetTransferStatus

618 Views
dsytj88
Contributor II

 hi Supporter

before sending CAN messages,FLEXCAN_DRV_GetTransferStatus is applied to check the  MB status,

if the MB is idle,then go to next step,otherwise,it's blocked here and waiting.

while(FLEXCAN_DRV_GetTransferStatus(CANInstancex,TX_MAILBOX_95) == STATUS_BUSY);
 SendMessage_CAN(CANInstancex, TX_MAILBOX_95,0x111, data,  dataLen);

I found one thing abnormal,when one CAN bus is not connected physically,then it's alaways blocked here and

other task can't be implemented.

so in SDK S/W, where to set the MB in idle status? I see some place in interupt callback function,but if the MB is busy,

the interrupt is not enabled and how to set the MB to Idle?

Thank you

 

0 Kudos
1 Reply

559 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

the FLEXCAN_IRQHandler interrupt is called (and so internal variables are updated finally) when the message is transmitted or received successfully without error. If you have a node disconnected or it is alone on the bus, previously transmitted message is not acknowledged and is it re-transmitted still. Interrupt handler is not called. You can have error FLEXCAN_Error_IRQHandler interrupt called (or error callback if installed).

In your case you can use "if" statement and call it repeatedly

if(FLEXCAN_DRV_GetTransferStatus(CANInstancex,TX_MAILBOX_95) == STATUS_SUCCESS);

FLEXCAN_DRV_AbortTransfer function can abort transmission and restore driver's internal variables, i think.

BR, Petr

0 Kudos