Hi everyone,
I'm adding the CAN support to a controller using an Infineon XC161 uP. I've used the Dave application from Infineon to set all registers and INT, and I used the generated modules in my application. Now I can send/receive CAN messages but I found a problem: - to debug the application I created transmission problems and I find that the TEC counter in AECNT register never exceed the 128 limit. This causes that BOFF flag is never set and the EWRN flag is set only if I set the EWRNLVL <= 128 !
Is there someone here that can help me ?
Thank you !
How are you generating the transmission problem?
From the user's manual: If the bit stream processor itself detects an error while a transmit operation is running, the transmit error counter is incremented by 8.
The CAN controller is in error-active state, if both error counters are below the error-passive limit of 128. It is in error-passive state, if at least one of the error counters equals or exceeds 128.
Could it be that you are transitioning from error-active to error-passive and this is why the AECNT has stopped at 128? For example if you try to transmit a message and you are the only node in the network this is the behavior you will get (ACK error).
Thanks to your reply I understand that the counter stops when the TwinCan enters in error-passive mode; am I right ? Now the question is: how can the counter exceed the 255 limit (and then enter in bus-off state) if it is stopped everytime he reach the value of 128 ? I suppose that I miss something but I don't understand what.......
am I right? yes
My understanding is you will never go bus off from an ACK error.
When the CAN module is in the error-active state it will transmit an error frame (to its own frame in the case I described before) since no other nodes acknowledged your message. Once you reach the TEC limit then you (your CAN node) will stop sending error frames and become error-passive. The message however is being sent on the bus (it will be sent forever or until you cancel it or until someone else acknowledges it).
Read the CAN spec from Bosch (in particular section 8, Fault Confinement) and setup your test to bring you to a bus-off condition.
www.semiconductors.bosch.de/.../can2spec.pdf