Unable to receive Extended Message ID CAN frame

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

Unable to receive Extended Message ID CAN frame

Jump to solution
2,123 Views
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!

Labels (1)
1 Solution
945 Views
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

View solution in original post

0 Kudos
3 Replies
946 Views
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 Kudos
945 Views
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 Kudos
945 Views
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 Kudos