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.

TM4C129EKCPDT: CAN message transmission control

Part Number: TM4C129EKCPDT

Hi,

I am new to CAN bus application. I have a question about CAN bus communication reliability.

When a message is sent by Node A, any node on the bus will acknowledge if the message is correctly received. This happens at hardware level. This means, if the sender (A) sends a message to node B, and wants to make sure node B has received the message, it cannot rely on the acknowledge since any other node will do so.

Does this mean, if we want to to guarantee the success of the message delivery between two nodes, a higher level acknowledge has to be established?  Or the lower level CAN error detection mechanism is already enough?

In other words, if node A wants to send a message to node B, is it possible that node C receives the message but not B has not, even if node B is on the bus?

  • Hello Tianlei,

    I am not sure I agree with your description of what happens with a message is sent by Node A.

    Each CAN message includes a CAN ID and that is how you can send messages to specific devices. Every CAN device on the bus should have its own unique CAN ID. If you are re-using the same CAN ID that opens up a lot of issues and is not how the CAN interface is designed.

    So you don't need any higher level acknowledge, just to ensure each of your CAN devices have unique ID.

    Best Regards,

    Ralph Jacobi

  • Hi Ralph,

    I am a bit confused. Can you please clarify the following?

    1. Is a CAN message allowed to be sent to multiple nodes?

    2. if yes, multiple CAN nodes will need to have the same filter set up for that CAN ID

    3. when the CAN message is sent by node A, those CAN node will all acknowledge if no error is detected.

    4. will other CAN nodes (not having that filter) also acknowledge the message because the message has been successfully received(physically) but not interested (logically)?

    Regards,

    Tianlei

  • When a message is sent by Node A, any node on the bus will acknowledge if the message is correctly received. This happens at hardware level. This means, if the sender (A) sends a message to node B, and wants to make sure node B has received the message, it cannot rely on the acknowledge since any other node will do so.

    This is how a CAN protocol is supposed to work. Messages in CAN are not confirmed. CAN assumes that all messages are compliant with the defined standard and if they do not, there will be a corresponding response by all nodes in the network. All nodes in a CAN network receive the same message at the same time, meaning each node listens to the network bus and will receive every transmitted message. the message filter guarantees that the receiving nodes will only react to the data that is relevant to them. 

    In other words, if node A wants to send a message to node B, is it possible that node C receives the message but not B has not, even if node B is on the bus?

    Your node C should use the acceptable filter to filter out the messages that are only relevant to node' C's intended functions. If node B ack'ed then you know node B receives the message. If node B does not ack, then it is an error on the bus. It is your system application that will program node C to not receive a certain message. CAN nodes do not care who send the message. CAN nodes only care if the message is intended to them. Think of a CAN bus in a car. There are nodes who will only respond to a message that tell them to close the window. There are some nodes who will only respond to a message that tell them to turn off the lights. When a message (it does not matter who sends it) is broadcasted to close the window, all nodes on the bus who are programmed to respond to this message will close the window. If a message is broadcasted on the bus to turn off the light, these nodes will not respond to them. 

  • Hi Charles,

    Do you mean that if a receiver is not programed to receive a message, it will not acknowledge this message (by putting a dominant bit), i.e., the sender can rely on the acknowledge to decide if the message has been successfully received (if it knows only one receiver on the bus is interested in this particular message).

    This is the thing I want to clarify - does the message filter determine whether the message will be acknowledged?

    Thanks

  • Hi,

      I think this website has good overview of the CAN protocol. https://www.kvaser.com/can-protocol-tutorial/. I'm not a CAN expert but I think you can program node B to send a message back to node A indicating that it has received the message from node A as a way to acknowledge the receipt of the message from node A. You need to need to design your system level protocol for that.

    Acknowledgement Check

    All nodes on the bus that correctly receives a message (regardless of their being “interested” of its contents or not) are expected to send a dominant level in the so-called Acknowledgement Slot in the message. The transmitter will transmit a recessive level here. If the transmitter can’t detect a dominant level in the ACK slot, an Acknowledgement Error is signaled.

  • Hi Charles,

    Thanks for the reply. I did some experiment on the acknowledge part. You are right. A node will always acknowledge a message even if the message does not pass the filter.

    This raised an interesting question: is the higher level message confirmation really needed? If the message is acknowledged, and not disrupted by error message, it means the all other nodes have seen the correct message from the wire. The only chance for a node on the bus not getting this message would be its internal issue. Do we really need to care about this?

    Hope somebody with CAN experience in the forum can answer this.

    Regards,

    Tianlei

  • Hi Tianle,

      You are right that messages in CAN are not confirmed because that would unnecessarily increase the bus traffic. What I mean by confirm is not the same as acknowledge. All nodes will acknowledge if the message is received correctly on the wire and if there is no malfunction within the nodes. The intended recipient of the broadcast message does not reply back (or confirm) that it has received the message. I think this is what you were asking in the beginning. You were asking what if node B (the intended recipient) does not acknowledge on the bus but rather node C who is not the intended recipient. In this case, the transmitter doesn't know who really received the message. The data link layer protocol does not handle this. I think it will be the higher level like CANopen who needs to take care of this such as communication model based on master and slave configuration. We are not experts in the system level configurations and application. Our knowledge is more limited to the MCU capabilities.

  • Thanks Charles. This has helped clarify my question.