This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Managing interrupts (epass, ewarn) flooding when CAN bus is disconnected or wrong baud rate is set

Other Parts Discussed in Thread: TM4C1290NCZAD

Hi,

I am currently working on making CAN communication on my TM4C1290NCZAD as reliable and robust as possible.

While testing many scenarios I noticed that controller gets flooded with ewarn and epass related interrupts if I disconnect the CAN cable or set incorrect baud rate. Depending on situation interrupts are arriving every 100-300uS. I am always reading CANINT register and CANSTS reg or adequate message object in my ISR, so interrupt gets cleared every time.

While this flooding is not a tragedy, it is putting some unnecessary load on the CPU. Hence, I would like to ask if there is way to minimise this effect?

Ideally, I would like to be able to receive an interrupt only if something changes. e.g. ewarn or epass bit is set or goes away. Being interrupted every time just to see that situation has not changed since last interrupt does not seem necessary in my application.

So far I was not able to come up with nice way of handling this problem. I know I can mask interrupts for some time and then enable them again to see if something has changed but that does not seem to be a good solution as it introduces unnecessary delays.

Is there a more elegant way ?

I will greatly appreciate your help.

Thank you,

Peter A.

  • Can you show us your handling and recovery code?

    Robert
  • Hi Robert,
    Thank you for your response. I was able to figure out what was happening yesterday.
    The problem was not the (Tiva's) CAN controller itself but the CAN to USB converter that I used for testing. When I was trying to cause a BUS error I was always setting incorrect baud rate on the CAN2USB and was sending a single message (from CAN2USB) - expecting to see a single (or 2) interrupts on Tiva.
    But I always saw thousands of interrupts and I thought that Tiva is generating them without any good reason. But it turned out that the CAN2USB device that I used had an automatic retransmission enabled by default and instead of sending a single message it was sending thousands and that was causing the interrupts.

    Sorry for the confusion and thank you for trying to help.
    Peter A.
  • No problem, glad you found it.

    Robert