Flexcan example

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Flexcan example

跳至解决方案
6,271 次查看
Awera
Contributor III

Hi,


Is flexcan receiving its own sent messages, even if LoopBack is disabled?

 

In the flexcan example, when i change the global mask to FLEXCAN_Set_global_stdmask (CAN_DEVICE, 0); I receive the same message I'm sending and I don't know why. And if I erase this code line, I can't receive any message.

 

Someone knows why it happens?

 

Thank you

0 项奖励
1 解答
2,980 次查看
Awera
Contributor III

Hi,

 

I get contact with Freescale and they answer me:

 

The statement of the reference manual that you say is wrong. The statement should say the next:

"Note that FlexCAN only receive frames transmitted by itself if another device (node) on the CAN bus acknowledges the frame, which device has an ID that matches the FlexCAN Rx MB ID. If no other node acknowledges the frame, an ACK error is generated and, in this case, the module does not receive the frame sent by itself."

And  unfortunately it's not possible to disable the Self-Received Frames.
The FlexCAN will receive frames transmitted by itself if another device on the CAN bus acknowledges the frame. If no other node acknowledges the frame, an ACK error is generated and, in this case, the module does not receive the frame sent by itself. That means the same FlexCAN module can't acknowledge its own message.
So all you can as an alternate to disabling this feature would be to set up a filter that ignores the frame when the ID of the frame matches the ID of the FlexCAN MB.
You may filter out self-received frames on hardware level by configuring ID masking (Rx Mask Registers RXGMASK, RX14MASK and RX15MASK).

 

So, you can reject your own messages unless you put a software mask

 

在原帖中查看解决方案

0 项奖励
4 回复数
2,979 次查看
louef
Contributor II

I guess it depends on the MCU, a kinetis K60 has this:

MCR SRXDIS Self Reception Disable: This bit defines whether FlexCAN is allowed to receive frames transmitted by itself.

0 项奖励
2,979 次查看
PetrM
Senior Contributor I

Yes, according to the FlexCAN part of processor reference manual ("Self-Received Frames"). It receives it's own frame when no other device acks the frame and there's a local RX message buffer, that matches the ID.

 

If you set global mask to 0, any frame passes this first stage of filtering and it seems that in the example RX mailbox matches the filtered TX ID.

 

If you erase that global mask setting, the corresponding register keeps its initial value which is "all ones" = ID has to match exactly.

 

PetrM

 

2,979 次查看
Awera
Contributor III

Hi,

 

thanks for your reply. I have the same problem even I connect other station in the line. I only have this problem if I set the global mask to 0 ( no filtering).

 

I receive the same message I'm transmiting even the other station listents the message ( I know it because it's processing the data). My CAN node isn't in Loop back mode and if I change the global mask ( not match the RX ID with message ID) the problem disappears.

 

Do you know why ?

 

Thanks

0 项奖励
2,981 次查看
Awera
Contributor III

Hi,

 

I get contact with Freescale and they answer me:

 

The statement of the reference manual that you say is wrong. The statement should say the next:

"Note that FlexCAN only receive frames transmitted by itself if another device (node) on the CAN bus acknowledges the frame, which device has an ID that matches the FlexCAN Rx MB ID. If no other node acknowledges the frame, an ACK error is generated and, in this case, the module does not receive the frame sent by itself."

And  unfortunately it's not possible to disable the Self-Received Frames.
The FlexCAN will receive frames transmitted by itself if another device on the CAN bus acknowledges the frame. If no other node acknowledges the frame, an ACK error is generated and, in this case, the module does not receive the frame sent by itself. That means the same FlexCAN module can't acknowledge its own message.
So all you can as an alternate to disabling this feature would be to set up a filter that ignores the frame when the ID of the frame matches the ID of the FlexCAN MB.
You may filter out self-received frames on hardware level by configuring ID masking (Rx Mask Registers RXGMASK, RX14MASK and RX15MASK).

 

So, you can reject your own messages unless you put a software mask

 

0 项奖励