AnsweredAssumed Answered

LPC1549: multiple CAN filters using ccan_rom API

Question asked by Justin King on Oct 22, 2018
Latest reply on Oct 24, 2018 by jeremyzhou

I'm utilizing the LPCOpen libraries called "ccan_rom.c," "rom_can_15xx.h," and "romapi_15xx.h" to set up a basic CAN interface for the LPC1549.

 

In the example code, there is this excerpt:

/* Configure message object 1 to receive all 11-bit messages 0x400-0x4FF */
msg_obj.msgobj = 1;
msg_obj.mode_id = 0x400;
msg_obj.mask = 0x700;

LPC_CAND_API->hwCAN_ConfigRxmsgobj(pCanHandle, &msg_obj);

Which is used to configure a receive object filter.

This sets up one filter, essentially.

 

I tried to modify this code to the following:

msg_obj.msgobj = 1;
msg_obj.mode_id = 0x400;
msg_obj.mask = 0x700;

LPC_CAND_API->hwCAN_ConfigRxmsgobj(pCanHandle, &msg_obj);

msg2_obj.msgobj = 2;
msg2_obj.mode_id = 0x10000320;
msg2_obj.mask = 0x10000400;
LPC_CAND_API->hwCAN_ConfigRxmsgobj(pCanHandle, &msg2_obj);

In an attempt to add multiple filters.
I thought this would create two receive message objects with different filters, but it does not seem to.
No matter what I do, the ISR is only thrown for the first entry. If I comment out the msg_obj code portion, then the 0x10000320 filter is applied. If I leave the msg_obj code portion uncommented, then the 0x400 filter is applied, and the 0x10000320 filter is not.

What is the right way to add multiple filters, or multiple receive message objects using the ccan_rom API?

Outcomes