Author Topic: CAN Message Filtering Issue  (Read 2816 times)

0 Members and 1 Guest are viewing this topic.

Offline ganeshredcobraTopic starter

  • Newbie
  • Posts: 4
CAN Message Filtering Issue
« on: January 31, 2014, 10:25:27 am »
Hi,
 
I am trying to implement CAN Message Filtering but the node is not filtering its accepting all ID's.This is the code What will be the issue?
I am using PIC18F25K80 and PIC C18 Compiler.

RXM0SIDH = 0xFE; 
RXM0SIDL = 0x00; 
RXM0EIDH = 0x00;   
RXM0EIDL = 0x00;

RXF0SIDH = 0xFC; 
RXF0SIDL = 0x00;   
RXF0EIDH = 0x00; 
RXF0EIDL = 0x00;
 
RXB0CON = 0x00;
Is anything More to add
 

Offline arcom

  • Contributor
  • Posts: 42
  • Country: hr
    • Arc's Lab
Re: CAN Message Filtering Issue
« Reply #1 on: January 31, 2014, 11:38:30 am »
You have defined only one message filter and there are 6 of them in Mode 0 (assuming you use Mode 0). By default, filters and masks are setup so that they allow all messages through. In your case, RXF0+RXM0 will block certain messages but other filters (RXF1-RXF5) will allow them so in the end you still receive all messages. You need to configure all filters to the same value if you want to filter specific messages (also also set both masks to the same value).

If you are using Mode 1 or Mode 2, there is a set of special registers available (RXFCONn) where you can enable/disable each filter as required.
 

Offline ganeshredcobraTopic starter

  • Newbie
  • Posts: 4
Re: CAN Message Filtering Issue
« Reply #2 on: February 03, 2014, 06:29:57 am »
Thanks arcom that really helped.Can you explain how filter and mask works and also how to configure RXFCONn
 

Offline ganeshredcobraTopic starter

  • Newbie
  • Posts: 4
Re: CAN Message Filtering Issue
« Reply #3 on: February 03, 2014, 07:37:39 am »
How can a i set a filter so that it must support ID's 0x7EX ie from from 0x7E0 to 0x7EF?
 

Offline matkar

  • Regular Contributor
  • *
  • Posts: 153
  • Country: si
  • Sixty percent of the time it works EVERY time.
Re: CAN Message Filtering Issue
« Reply #4 on: February 03, 2014, 03:58:25 pm »
For extended ID set  the values as per picture. If your ID is standard change all filters to standard as well.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf