CAN Bus Message ID filtering

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

CAN Bus Message ID filtering

6,448 Views
Besir
Contributor I

Hı,

 

I'm using MCF52235 can bus protocol for communication

 

I send message from transmitter device to receiver device . In transmitter device I receive the message that have send to receiver device. But I must not  receive the messages that I have sent.

 

How can  I filtering message ID in a device and How can I determine an ID interval for receiver device

 

example: only got ID : 0x00A

 

example for interval : only got   (0x005- 0x0FF) - receive messages ID  between  0x005 and 0x0FF.

 

can you help me?

Labels (1)
0 Kudos
1 Reply

1,652 Views
TomE
Specialist II

> I send message from transmitter device to receiver device . In transmitter

> device I receive the message that have send to receiver device.

> But I must not  receive the messages that I have sent.

 

You could filter these out in software. You know what you're sending so just ignore them.

 

The rules from the Reference Manual are:

 

30.3.14 Matching Process
The matching process is an algorithm that scans the entire MB memory looking for Rx MBs programmed
with the same ID as the one received from the CAN bus. Only MBs programmed to receive participate in
the matching process for received frames.

 

You must have MBs with IDs matching the transmit frame, or you have the masking registers set to ignore ID bits.

 

However the following may matter, and it doesn't make any sense to me:

 

30.3.13.1 Self-Received Frames
Self-received frames are frames that are sent by the FlexCAN and received by itself. The FlexCAN sends
a frame externally through the physical layer onto the CAN bus. If the ID of the frame matches the ID of
the FlexCAN MB, the frame is received by the FlexCAN. Such a frame is a self-received frame. FlexCAN

does not receive frames transmitted by itself if another device on the CAN bus has an ID that matches the
FlexCAN Rx MB ID.

 

So how does the transmitter know a receiver had an ID matching one of its receive MB IDs? I was under the impression that all receivers ACK a valid message, and not only the one(s) that actively received it. The Bosch specs aren't clear on this. I have found clarification in the Microchip AN713 which says:

 

The Acknowledge Field is utilized to indicate if the message
was received correctly. Any node that has correctly
received the message, regardless of whether the
node processes or discards the data, puts a dominant
bit on the bus in the ACK Slot bit time

 

So there's no way a transmistter knows if a receiver actually processed a message.

 

> How can  I filtering message ID in a device

 

Read the Reference Manual. There are register that control this.

 

> and How can I determine an ID interval for receiver device

 

What do you mean "ID interval"? All MESSAGES have to have unique IDs. The IDs aren't "Transmitter IDs" or "Receiver IDs" like the MAC address to an Ethernet chip. You need a list of all unique messages in your system. Only one device is allowed to ever transmit a particular message ID. You can then program the receivers with filters (filter masks and IDs in the Message Buffers) to decide which messages you want particular receivers to receive. But it is usually easier to "receive everything" and then throw away the ones you don't care about in software.

 

http://en.wikipedia.org/wiki/CAN_bus

 

Id. allocation

Message id's must be unique on a single CAN bus, otherwise two nodes would continue transmission beyond the end of the arbitration field (id.) causing an error.

 

> example: only got ID : 0x00A

>

> example for interval : only got   (0x005- 0x0FF) - receive messages ID  between  0x005 and 0x0FF.

Could you provide more details of what you're doing? There's not enough there to understand what you're doing.

 

I think that using an IDs of "A" and "5" (00000000101) might not meet the spec as the CAN bus spec states:

 

IDENTIFIER
The IDENTIFIER’s length is 11 bits. These bits are transmitted in the order from ID-10
to ID-0. The least significant bit is ID-0. The 7 most significant bits (ID-10 - ID-4) must
not be all ’recessive’.

 

Tom

 

0 Kudos