S32K312 CAN Tx Status

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

S32K312 CAN Tx Status

872 Views
lua40927
Contributor III

Hello,
I am using the official example program for development

example program source: https://community.nxp.com/t5/S32K-Knowledge-Base/Example-S32K312-CAN-Transmit-amp-Receive-Using-MB-I...

 

My question is: After sending a message using "FlexCAN_Ip_Send" (for speed reasons, I didn't use FlexCAN_Ip_SendBlocking), I used "FlexCAN_Ip_GetTransferStatus" before the next message transmission to check whether the transmission was successful.

However, when the interval between FlexCAN_Ip_Send and FlexCAN_Ip_GetTransferStatus is extremely short, the value returned by FlexCAN_Ip_GetTransferStatus will be "busy", but the message was actually successfully sent.

I understand that adding a delay could solve this problem, but for performance reasons, I don't want to add a delay.

I'd like to ask if there are other faster methods to check whether a message has been successfully transmitted, or if you can provide an approximate minimum interval to avoid falsely identifying it as busy.

Thanks

0 Kudos
Reply
1 Reply

837 Views
Julián_AragónM
NXP TechSupport
NXP TechSupport

Hi @lua40927,

If you are using interrupts, you can set a flag in the transmit complete event:

Snag_2fa272a0.pngSnag_2fa272a0.png

This method is faster and avoids busy waiting, like polling for the transfer status to change.

Best regards,
Julián

0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-2156635%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ES32K312%20CAN%20Tx%20Status%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2156635%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHello%2C%3CBR%20%2F%3EI%20am%20using%20the%20official%20example%20program%20for%20development%3C%2FP%3E%3CP%3Eexample%20program%20source%3A%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2FS32K-Knowledge-Base%2FExample-S32K312-CAN-Transmit-amp-Receive-Using-MB-Interrupt-DS3%2Fta-p%2F1818790%22%20target%3D%22_blank%22%3Ehttps%3A%2F%2Fcommunity.nxp.com%2Ft5%2FS32K-Knowledge-Base%2FExample-S32K312-CAN-Transmit-amp-Receive-Using-MB-Interrupt-DS3%2Fta-p%2F1818790%3C%2FA%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%3EMy%20question%20is%3A%20After%20sending%20a%20message%20using%20%22FlexCAN_Ip_Send%22%20(for%20speed%20reasons%2C%20I%20didn't%20use%20FlexCAN_Ip_SendBlocking)%2C%20I%20used%20%22FlexCAN_Ip_GetTransferStatus%22%20before%20the%20next%20message%20transmission%20to%20check%20whether%20the%20transmission%20was%20successful.%3C%2FP%3E%3CP%3EHowever%2C%20when%20the%20interval%20between%20FlexCAN_Ip_Send%20and%20FlexCAN_Ip_GetTransferStatus%20is%20extremely%20short%2C%20the%20value%20returned%20by%20FlexCAN_Ip_GetTransferStatus%20will%20be%20%22busy%22%2C%20but%20the%20message%20was%20actually%20successfully%20sent.%3C%2FP%3E%3CP%3EI%20understand%20that%20adding%20a%20delay%20could%20solve%20this%20problem%2C%20but%20for%20performance%20reasons%2C%20I%20don't%20want%20to%20add%20a%20delay.%3C%2FP%3E%3CP%3EI'd%20like%20to%20ask%20if%20there%20are%20other%20faster%20methods%20to%20check%20whether%20a%20message%20has%20been%20successfully%20transmitted%2C%20or%20if%20you%20can%20provide%20an%20approximate%20minimum%20interval%20to%20avoid%20falsely%20identifying%20it%20as%20busy.%3C%2FP%3E%3CP%3EThanks%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2156940%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20S32K312%20CAN%20Tx%20Status%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2156940%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F200168%22%20target%3D%22_blank%22%3E%40lua40927%3C%2FA%3E%2C%3C%2FP%3E%0A%3CP%3EIf%20you%20are%20using%20interrupts%2C%20you%20can%20set%20a%20flag%20in%20the%20transmit%20complete%20event%3A%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Snag_2fa272a0.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Snag_2fa272a0.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F353718i9041193F1A72C124%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Snag_2fa272a0.png%22%20alt%3D%22Snag_2fa272a0.png%22%20%2F%3E%3Cspan%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3ESnag_2fa272a0.png%3C%2Fspan%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EThis%20method%20is%20faster%20and%20avoids%20busy%20waiting%2C%20like%20polling%20for%20the%20transfer%20status%20to%20change.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EBest%20regards%2C%3CBR%20%2F%3EJuli%C3%A1n%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E