Yang
Yang

Reputation: 799

How to avoid conflict on a CAN bus when sending data frames with the same frame id?

Usually, a remote frame is sent to require data from another node, which sends a corresponding data frame with the same identifier later. But when both of the nodes are sending a data frame, how to avoid the bus conflict?

For example, node A sends a data frame to node B, e.g., move 10mm forward, then node B returns a data frame to node A when the motion is completed. So that both of the messages have the same data and the identifiers are same.

Update

Currently the node id is assigned to an entire PCB, which contains mulitple components like sensors and motors. According to Lundin's post, I realize that it's impossible to distinguish these components. There is a high possibility to lead to bit error, when sending messages to a mortor, and meanwhile get a response message from sensors, for example. No arbitration takes effect in this case. So, are the following points the best practices?

  1. Each of the sensor or motor should be defined as a node with a unique identifier. But it seems not convenient to move components between different PCBs, since the filters of the corresponding PCBs should be updated every time.
  2. Each of the PCB should define more filters to accept all the identifiers of the nodes on it.
  3. ONLY use remote frame to require data from sensor.

Upvotes: 0

Views: 1584

Answers (1)

Lundin
Lundin

Reputation: 215255

This is not a problem as long as they never send at the same time. If you implement a handshaking scheme like the one you describe, where only one node is allowed to send data at a time, it will work fine.

Otherwise it is common to use node id to distinguish between nodes. For example if your data has identifier 0x100, then node A can send id 0x100 and node B id 0x101. The receiver can then treat these the same.

Upvotes: 1

Related Questions