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.