FlexCAN RX,TX simultaneously

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

FlexCAN RX,TX simultaneously

678 Views
PaoloRB
Contributor II

Hi all, I'm currently using flexCAN on imx6 rt1170 EVKB. I'm trying to have the device working but I have an issue when I trigger a non blocking TX request after a Rx request. I'm using different MB channel for Rx an Tx but I get kStatus_FLEXCAN_ErrorStatus back on the ISR callback function after trying to Tx  a frame using FLEXCAN_TransferFDSendNonBlocking. Is there something I should consider, any suggestions about what can cause the problem? do I always need to wait for a MB to finish before trigger any other one? I f I have for example 4 RX channels and 2 TX channels, how can this be handle to Rx and Tx simultaneously?

 

Thanks in advance for any clarification

Tags (1)
0 Kudos
Reply
1 Reply

647 Views
mayliu1
NXP Employee
NXP Employee

Hi @PaoloRB ,

Thank you so much for your interest in our products and for using our community.

Question:  I get kStatus_FLEXCAN_ErrorStatus back on the ISR callback function after trying to Tx  a frame using FLEXCAN_TransferFDSendNonBlocking. Is there something I should consider, any suggestions about what can cause the problem?

Answer:  If you got  kStatus_FLEXCAN_ErrorStatus, I suggest you check CAN frame format, mismatched CAN frame format will lead to this error. Also, Please pay attention to CAN bus error. I suggest you can refer to SDK demo routin. 

Question: do I always need to wait for a MB to finish before trigger any other one? I f I have for example 4 RX channels and 2 TX channels, how can this be handle to Rx and Tx simultaneously?

Answer: In non-blocking modeI don't think you need to wait for a MB to finish before trigger any other one, because you use different MB for Tx and Rx. But you must ensure the MB handle completion through ISR callback function.

For your case, the current MB get error, It should clear CAN Error status flags(FLEXCAN_ClearStatusFlags) in your CAN  ISR callback function and make sure the MB is free, notify to your main code for future logic process.

If the CAN communication is normal,  you can check the current MB Number is free in CAN ISR callback , do your logic and then you can trigger the current MB again.

mayliu1_0-1733888339149.png

Wish it helps you.
If you still have question about it, please kindly let me know.

 

Best Regards

mayliu

 

0 Kudos
Reply