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.

AM2634: CAN bus collision avoidance

Part Number: AM2634

Good day Experts

Please advise what is correct way of collision avoidance on bus. Currently I observe next situation - I lose TX packet if RX packet with higher incomes simultaneusly.

 - can the hardware perform re-transmit without any additional actions from software side ?

 -  should I get any CAN related interrupt in this case ?

Thank you 

  • Hello Volodymyr,

    CAN works by using a carrier-sense, multiple-access (CSMA) protocol which includes collision detection. Using CSMA means that each node on a bus has to wait for a set amount of time with no bus activity occurring before attempting to send a message. Any collisions are resolved through bit-wise arbitration based on the pre-set priority of each message. This is in the identifier field of a message and the higher priority identifier always gains the bus access. So based on your description you should review the priority of the RX packet versus your TX packet and determine if that's the reason for this situation. As far as re-transmission goes, I would imagine your CAN bus should be configured for automatic re-transmission. If not, you'd want to make sure the CAN bus is available and then continue with re-transmission. 

     -  should I get any CAN related interrupt in this case ?

    I don't believe so if re-transmission is being used. If not then yes you'd get interrupts and would monitor Transmission Cancellation Finished and Transmission Complete to determine next actions.

    Best Regards,

    Ralph Jacobi

  • Hello Ralph

    Thank you for such detailed answer. The fact that messages are lost due to collision was confirmed with test build where CAN IDs were reassigned in the way when previously lost messages became more priority. For now CAN frame priority review is not an option - but yes that works, we do not observe any issues.

    What I found is that Disabled Automatic Re-transmission (DAR) Mode is enabled by default so in our software too ( MCAN_CCCR[6] DAR bit is 0 ).

    I assume automatic re-transmission works ( from other side I will need to prove it ) but on reception side the messages are still missing and that's an issue for us. Please advise  if there are additional places where re-transmission feature can be tuned more precisely.

    Thank you

  • Hello Volodymyr,

    but on reception side the messages are still missing and that's an issue for us.

    If I am understanding correctly, you are saying that when receiving messages if the transmission is interrupted you are not able to receive a re-transmitted message? If so that's an issue with either the other transmitter or maybe your flow if you need to trigger the re-transmission. If I am not understanding that correctly please elaborate further on which side (AM263 or other device) is the transmitter, which side is the receiver, and which direction the message that is missed is flowing from.

    Best Regards,

    Ralph Jacobi

  • Hello Ralph

    Your understanding seems to be correct

    My side is AM263( device under test ) acts as transmitter and produces periodic messages to the tester equipment. Sometimes it can get/receive requests  from tester ( various commands ). CAN IDs of such commands are  of more priority than periodic messages from device under test.

    The issue arise during simultaneous transmission of both device under test  message and tester equipment request. The issue with lost message was identified during tester equipment log analysis. It shows tester equipment request but expected message from device under test is missing.

    1. First option is that re-transmission didn't occur on AM263 side ( device under test)

    2. Second option is that re-transmission occured on AM263 side but tester equipment could not receive it ( so we see no message in the log )

    As I mentioned before we have DAR = 0 which means that automatic re-transmission is enabled in AM263 software. Is it enough or some special actions should be applied in software to initiate re-transmission?

    Thank you 

  • Hello Volodymyr,

    As I mentioned before we have DAR = 0 which means that automatic re-transmission is enabled in AM263 software. Is it enough or some special actions should be applied in software to initiate re-transmission?

    To my understanding, that is sufficient and there is no other action needed in software to initialize re-transmission. I would recommend to put a monitor on the CAN bus to isolate whether the issue is due to 1. or 2.

    Best Regards,

    Ralph Jacobi