Filter out a CAN-message with an unique frame-id

31 May 2010

How do I filter out a CAN-message with an unique frame-id ?

On a car-CAN-bus I only want to see CAN-message with, lets say, the address x01E5.

I have seen in the manual for LPC1768 that it has acceptance filters for the CAN-controller.

/Hans

01 Jun 2010

I think, you have to program the acceptance filter yourself. Thats how i did it, because i didn't find a function for that in the mbed library.

01 Jun 2010

Hello Sebastian,

Sounds great !  How did you do it?

Grateful if you can show me.

 

02 Jun 2010 . Edited: 02 Jun 2010

This ist for using 29 Bit ID. If you want to use 11 Bit ID it would be a little bit different, but I can write it here as well, if you want. (I'm sorry for my englisch)

// 1x 29 Bit ID -> END_OF_TABLE = 4; SCC 1; 

void CanWrFilter(unsigned char SCC, unsigned int ID){

unsigned int                 value;

LPC_CANAF->AFMR = 0x00000001;  // Setup Acceptance Filter Configuration; Acceptance Filter Mode Register = Off;



value =  ((SCC-1)<<29) | id ;
LPC_CANAF_RAM->mask[0]= value;



/* Setup acceptance filter pointers */

LPC_CANAF->SFF_sa     = 0;
LPC_CANAF->SFF_GRP_sa = 0;
LPC_CANAF->EFF_sa     = 0;
LPC_CANAF->EFF_GRP_sa = END_OF_TABLE;
LPC_CANAF->ENDofTable = END_OF_TABLE;

LPC_CANAF->AFMR = 0x00000000;                  // Use acceptance filter

}

02 Jun 2010

Just so that you know, CAN has not been forgotten, and is in my work queue to look at quite soon.

14 Feb 2011

Jon any news of adding filters soon?

14 Feb 2011

Hi Jason,

We don't plan to have filters added to the core libraries at the moment. This is partly as controllers seem to do it in different ways, so there wasn't immediately an obvious way to abstract this, but also to see how people start to use CAN and how we can best support it. There are lots of higher level CAN stacks, so I'm assuming people will start porting and using them for more complex projects. The focus of the libraries at the moment is not to support every eventuality, but the core functionality that gets something up and running.

I'd encourage you to poke the appropriate registers to setup the filters as Sebastian demonstrates, and if you do find a natural way, perhaps wrap it up in a small library so others can experiment. Would be great to see if a useful model emerges.

Hope your project is going well :)

Simon

04 Mar 2011

Hi everybody!

I don't understand what is LPC_CANAF and LPC_CANAF_RAM in Sebastian's code.

Thank you for your reply

20 Sep 2011

Found CAN_wrFilter() function at following site.

http://www.dragonwake.com/download/LPC1768/Example/CAN/CAN.c

It works great as expected.

/*-------------------------------------------------------------
  setup acceptance filter.  CAN controller (1..2)
 *-------------------------------------------------------------*/
void CAN_wrFilter (uint32_t ctrl, uint32_t id, uint8_t format);
26 Mar 2012

FYI,

I published a sample program of the CAN filtering.

http://mbed.org/users/ym1784/programs/CAN_MONITOR/m77jas

18 Dec 2012

link update

Yoshi Mimura wrote:

Found CAN_wrFilter() function at following site.

http://www.dragonwake.com/download/LPC1768/Example/CAN/CAN.c

The CAN.c file has been removed from the site. Instead, the whole Example.zip file is placed as follows;

http://www.dragonwake.com/download/LPC1768/Example.zip

26 Oct 2016

Hello,

I need help on a task that requires me to extract a key from the CAN bus KoIEIkCAAACnAAAAIE4AAAAAAAAAAAAA////////9wMAAAACQB There is no need to interpret it but I just need to extract this from the CAN bus. the Identifier is 11bit and the Data is 60 byte in all coming from the multiplexers. Could you help me with the software, hardware and code to extract this.

kindly help thanks

Thank you for entering into the world of new dimensions. I am delighted to join the conversation.[url=http://www.aghgxjw.com/][color=#ffffff]gclub[/color/][/url]

14 Sep 2019

Are CAN filters now added to the library ?