cancel
Showing results for 
Search instead for 
Did you mean: 

CAN Communication

Kamil_16
Associate II

I am implementing a CAN communication structure with one master and two slaves. Both slave devices perform exactly the same function, meaning their hardware and firmware are essentially identical. The master’s intention is to send commands only to a specific slave at a given time and receive data only from that targeted device. However, the issue I am facing is that any CAN frame transmitted by the master is being accepted by both slaves. Because both devices share the same ID filtering configuration, each slave interprets the incoming message as if it were intended for itself. As a result, the system behaves like a broadcast communication instead of the desired unicast structure, which leads to unintended and incorrect operation. Is there a solution

5 REPLIES 5
mƎALLEm
ST Employee

Hello,

So why are you using the same ID for all slaves?

+ What MCU part numbers are you using? 

How to write your question to maximize your chances to find a solution

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

The slaves have different IDs but the same functions. ( STM32F4 DISC)

Hello,


@Kamil_16 wrote:

The slaves have different IDs but the same functions. ( STM32F4 DISC)


But this is contradictory with what you have already said in your first post: "However, the issue I am facing is that any CAN frame transmitted by the master is being accepted by both slaves. Because both devices share the same ID filtering configuration"

Could you please clarify?

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.
Ozone
Principal III

> I am implementing a CAN communication structure with one master and two slaves.

There is no such thing as "master" or "slave" in CAN.
The standard CAN protocol only knows nodes, and communication arbitration is based upon message IDs.

A kind of "master" role exists in higher-level protocols based upon CAN, e.g. CANopen or J1939.

> Because both devices share the same ID filtering configuration, each slave interprets the incoming message as if it were intended for itself.

You got that wrong.
IDs are assigned to messages, not to nodes.

LCE
Principal II

The big questions:

1) Is it required that you are compatible to any protocols / any standard CAN bus?

2) Or is that some internal bus only between your custom devices, just using the CAN hardware?

 

1) if yes, you have to adhere to any other protocols.

2) if yes, do what you want, like using different IDs, requests, responses with addresses, whatever...