MIMXRT1060-EVKB CAN related question

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

MIMXRT1060-EVKB CAN related question

432 Views
niz
Contributor III

Hello 

I have a question about the CAN driver. 

I followed the SDK CAN examples and try to send some CAN message out via the API : 

"FLEXCAN_TransferSendBlocking"

I can send out the CAN messages I want, however, when I stop the CAN bus simulation, looks like the the driver stucks at a while loop: 

"while (0U == FLEXCAN_GetMbStatusFlags(base, u64flag << mbIdx))"

and it blocks all the other part if the software. 

If the CAN message is not acknowledged, it will have the same issue  I think. 

In our application, we need to send out the CAN message periodically,  and we need this blocking API to make sure the CAN sending out. I tried to set up the flag in the CAN bus error handling interrupt to prevent calling the CAN transfer function, however, it still stuck at that while loop sometimes, which can cause the "bricked" board. 

Is there any way we can handle this situation? 

 

Thanks a lot for your help 

Labels (1)
0 Kudos
1 Reply

400 Views
Julián_AragónM
NXP TechSupport
NXP TechSupport

Hi @niz,

The function "FLEXCAN_GetMbStatusFlags(base, u64flag << mbIdx)" gets the interrupt flag of a given Msg Buffer.

One solution could be to clear the MbStatus (FLEXCAN_ClearMbStatusFlags(base, u64flag << mbIdx)) in order to bypass the while loop.

Please update me if any doubt arises.

Best regards, Julian

0 Kudos