K70 FlexCAN: thousands of error interrupts per second

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

K70 FlexCAN: thousands of error interrupts per second

1,246 Views
konrada
Contributor IV

Hello all,

I'm using a K70's integrated FlexCAN on a custom board, together with a third-party CANopen stack (by port GmbH) with a driver I've written.

 

Problem: when I activate the CANopen stack with no termination and no other CAN bus member present, I get a storm of error interrupts (roughly 3000 per second).

 

I can see that the CANopen stack has tried to send out its NMT 'hello this is NMT slave 1' telegram through the mailbox which does the transmitting. From what I know about CAN, I expect the FlexCAN to detect a lack of acknowledgement, increase the TX error counter and try to resend the NMT telegram, until TX error counter reaches 0x80, at which point FlexCAN goes into Error-Passive state.

 

What I observe is thousands of error interrupts per second, each time with ESR1=0x42252, (that is, SYNCH, ACKERR, TXWRN, TX, and ERRINT are 1 and FLTCONF=1, error passive). ECR reads as (TXERRCNT=128, RXERRCNT=0).

I have disabled TX warnings in CTRL1.TXWRNMSK, so I believe this isn't a TX warning interrupt. The acknowledgment sequence at the end of the ISR consists of

regs->ESR1 = CAN_ESR1_ERRINT_MASK; regs->ESR1 = CAN_ESR1_BOFFINT_MASK;

and I don't believe this is a case of unacknowledged interrupt; the system remains somewhat responsive after all. Also, the task which runs the main loop of the CANopen stack is never entered during that time, so I believe it's not the CANopen stack sending telegrams like crazy.

 

As far as I know the CAN spec, (e.g. rules in http://www.softing.com/home/en/industrial-automation/products/can-bus/more-can-bus/error-handling/fa... ), the FlexCAN should not leave the Error Passive state unless it successfully transmits a frame, which is impossible in my setup. So I expect it to stay error-passive and not tell me every time. Is that a reasonable expectation?

 

Greetings KA

0 Kudos
1 Reply

365 Views
konrada
Contributor IV

Hmm. Reading the K70 RM again, I see no rule that would prevent it from trying to resend the CAN frame and raising another error interrupt for the new ACK error.

 

I'll try polling errors. 

0 Kudos