CAN can not accept the specified ID

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

CAN can not accept the specified ID

748 Views
vnv
Contributor II

Hi,

I am using the LPC11C24 CAN communication ,CAN can not accept the specified ID,My example comes from the official,Some of my examples are as follows:

msg_obj.msgobj = 1;
msg_obj.mode_id = 0x400 | CAN_MSGOBJ_EXT;  //CAN_MSGOBJ_EXT=0x20000000
msg_obj.mask = 0x1FFFFFFF;
LPC_CCAN_API->config_rxmsgobj(&msg_obj);
while (1) {
__WFI(); /* Go to Sleep */
}

CAN can accept 0x 80000400,0x 60000400,0x40000400,0x20000400 0x400 ID.I want to accept only the specified 0x400 Extended frame ID.what should I do?

Labels (1)
4 Replies

510 Views
jeremyzhou
NXP Employee
NXP Employee

Hi ,

You can use the following code instead of the original code to receive the frame whose identifier is 0x400.

     msg_obj.msgobj = 1;
     msg_obj.mode_id = 0x400;
     //msg_obj.mask = 0x700;
        msg_obj.mask = 0x7FF;
     LPC_CCAN_API->config_rxmsgobj(&msg_obj);‍‍‍‍‍

And the Figure 1 exemplifies the testing results.

2017-05-02_14-02-43.jpgFig 1


Have a great day,
TIC

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

510 Views
vnv
Contributor II

Hi ,

You use the standard frame, I use the expansion of the frame.you can try my code.

msg_obj.msgobj = 1;
msg_obj.mode_id = 0x400 | CAN_MSGOBJ_EXT;
msg_obj.mask = 0x7FF;
LPC_CCAN_API->config_rxmsgobj(&msg_obj);

CAN can accept 0x 80000400,0x 60000400,0x40000400,0x20000400,0x400 ID.CAN can not accept the specified 0x400 Extended frame ID.

0 Kudos

510 Views
jeremyzhou
NXP Employee
NXP Employee

Hi ,

Thanks for your reply.

The extended ID can't beyond the 0x1FFF_FFFF, otherwise the ID can't be recognized.

     msg_obj.msgobj = 1;
     msg_obj.mode_id = 0x400|CAN_MSGOBJ_EXT;
     //msg_obj.mask = 0x700;
        msg_obj.mask = 0x1FFFFFFF;
        //msg_obj.mask = 0x7FF;
     LPC_CCAN_API->config_rxmsgobj(&msg_obj);‍‍‍‍‍‍‍‍‍‍‍‍

2017-05-04_16-34-59.jpg

To implement receive the specific extend ID frame, please the following code.
Have a great day,
TIC

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

510 Views
vnv
Contributor II

Hi,

I understand, thank you very much for your answer

0 Kudos