Unable to receive Extended Message ID CAN frame

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

Unable to receive Extended Message ID CAN frame

跳至解决方案
2,554 次查看
mnelson
Contributor I

Hello all!

I'm trying to convert a project (based on the MK10DX65VLH7) that previously used CAN frames with a standard Message IDs to using extended Message IDs. Previously, I could send and receive standard frames properly. I currently have two devices on my CAN bus. One device can send and receive the extended frames and the other (the MK10DX64) can only send them. I'm using Busmaster to verify the traffic.

Currently, I have the working device sending a frame with the message ID of 0xC001 onto the network. I can see the frame using Busmaster, but my interrupt never triggers on the MK10DX64. I'm slightly confused by the CAN_LDD component properties, I'm not quite sure what Message ID under Buffer Type or Individual Acceptance Mask under Buffer type does. I tried looking under the component help but the descriptions didn't explain much.

Here is a screenshot of my CAN_LDD component.

canldd.png

What I'm hoping for is to receive an interrupt for any extended message that is on the bus, not just 0xC001. Does anyone know how to configure this component to do that?

Thanks!

标签 (1)
1 解答
1,376 次查看
Petr_H
NXP Employee
NXP Employee

Hi,

Please note that the Individual acceptance mask filters the bits that are to be checked aginst given message ID. If there is 0 in the acceptance mask, the buffer accepts messages with any bit valus on that position. If there is 1, the received ID must match with ID set for the buffer (Message ID property).

If you have global acceptance mask disabled (as on your screenshot) it works like this:

can2.png

can1.png

So if the acceptance mask is 1FFFFFFF, all bits are checked so only C001 message is received.

To receive any message you shuold put there 0 and all messages will be received.

Regarding sending extended frames, you can find the example of sending Extended frames in Typical Usage page of the component help (opened with "Help on component" pop-up menu):

. . .

  Frame.MessageID = (0x123456U | LDD_CAN_MESSAGE_ID_EXT);         /* Set Tx ID value - extended */ 

  Frame.FrameType = LDD_CAN_DATA_FRAME;                           /* Specyfying type of Tx frame - Data frame */

  Frame.Length = sizeof(OutData);                                 /* Set number of bytes in data frame - 4B */

  Frame.Data = OutData;                                           /* Set pointer to OutData buffer */

  DataFrameTxFlg = FALSE;                                         /* Clear DataFrameTxFlg */

  Error = CAN2_SendFrame(MyCANPtr, 0U, &Frame);                   /* Sends the data frame over buffer 0 */

  while (!DataFrameTxFlg) {                                       /* Wait until data frame is transmitted */

  }

. . .  

Please let us know if you've been able to resolve it. We are not aware of any problems with this code.

Best regards

Petr Hradsky

Processor Expert Support Team

在原帖中查看解决方案

0 项奖励
回复
3 回复数
1,377 次查看
Petr_H
NXP Employee
NXP Employee

Hi,

Please note that the Individual acceptance mask filters the bits that are to be checked aginst given message ID. If there is 0 in the acceptance mask, the buffer accepts messages with any bit valus on that position. If there is 1, the received ID must match with ID set for the buffer (Message ID property).

If you have global acceptance mask disabled (as on your screenshot) it works like this:

can2.png

can1.png

So if the acceptance mask is 1FFFFFFF, all bits are checked so only C001 message is received.

To receive any message you shuold put there 0 and all messages will be received.

Regarding sending extended frames, you can find the example of sending Extended frames in Typical Usage page of the component help (opened with "Help on component" pop-up menu):

. . .

  Frame.MessageID = (0x123456U | LDD_CAN_MESSAGE_ID_EXT);         /* Set Tx ID value - extended */ 

  Frame.FrameType = LDD_CAN_DATA_FRAME;                           /* Specyfying type of Tx frame - Data frame */

  Frame.Length = sizeof(OutData);                                 /* Set number of bytes in data frame - 4B */

  Frame.Data = OutData;                                           /* Set pointer to OutData buffer */

  DataFrameTxFlg = FALSE;                                         /* Clear DataFrameTxFlg */

  Error = CAN2_SendFrame(MyCANPtr, 0U, &Frame);                   /* Sends the data frame over buffer 0 */

  while (!DataFrameTxFlg) {                                       /* Wait until data frame is transmitted */

  }

. . .  

Please let us know if you've been able to resolve it. We are not aware of any problems with this code.

Best regards

Petr Hradsky

Processor Expert Support Team

0 项奖励
回复
1,376 次查看
mnelson
Contributor I

Thank you Petr,

That makes sense (although opposite of what I originally assumed)!  Could you tell me where this is documented foe future reference?

Thanks!

0 项奖励
回复
1,376 次查看
Petr_H
NXP Employee
NXP Employee

You are welcome, the diagrams I put in my previous post are from CAN part of the MCU reference manual and the code is from Typical usage page of the online component help in Processor Expert.

best regards

Petr Hradsky

Processor Expert Support Team

0 项奖励
回复