FlexCAN ACKERR proper management

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

FlexCAN ACKERR proper management

893 Views
maxpag
Contributor I

Hello,

    using the FlexCAN peripheral on a K20 MCU, I am a bit puzzled on how to properly manage the NO ACK condition. If I enable the interrupt (CANx_CTRL1.ERRMSK <- 1) my handler gets called repeatedly and the CPU is prevented to do anything since it spends all its time serving the interrupt. If I disable the interrupt and poll the error flag (CANx_ESR1.ACKERR) in my loop, the result is the same - once you get ACKERR asserted it never goes away ... until the next power cycle.

    According to the reference manual, it should be enough to read from CANx_ESR1 to clear ACKERR flag, but this does not happen. My idea is that proper handling of this condition must be added. My firmware employs a modified version of the FlexCAN.c/h found in the SDK. Maybe it is outdated, but I haven't found relevant difference in the most recent one.

    Could you advise or point me to an implementation that correctly deals with ACKERR? Thank you.

Labels (1)
0 Kudos
2 Replies

737 Views
Alexis_A
NXP TechSupport
NXP TechSupport

Hi Massimiliano,

Can you tell me how are you testing this? 

One of the features of the CAN protocol is that will keep sending the package until one node answers. If during system start-up, only one node is operating, then its TXERRCNT increases in each message it is trying to transmit, as a result of acknowledge errors (indicated by the ACKERR bit in the Error and Status Register).

One way to manage the NO ACK condition is to check how many times the TXERRCNT increase, if the error happens a certain amount of times, stop the transmition and soft reset the module to clear the error signals. 

Let me know if this was helpful to you and I will wait for your comments.

Best Regards,

Alexis Andalon

0 Kudos

666 Views
PD
Contributor I

Alexis, is there a way to automatically disable disable automatic retries when there is a lack of ACK on the bus?  I'm seeing behavior right now where I lack an ACK when another device switches into listen only / passive mode and my NXP Microcontroller with FlexCAN floods the bus at a rate >=1000hz.  Ideally I'd be able to detect the ACK error, not flood the bus and send 1 message at a specified time interval to test for an ACK.

0 Kudos