|
|
View previous topic :: View next topic |
Author |
Message |
pom
Joined: 25 Nov 2004 Posts: 30 Location: Germany
|
Filter and mask Can-Messages |
Posted: Tue Mar 29, 2005 8:49 am |
|
|
A few weeks ago, I programmed a PIC18F258 with a can-communication. I had many questions to these, but at the end I was successful.
Now the PIC was brought into the system it shall work with and it doesnot work. It is a big system with much traffic on the can. The PIC doesnot receive the messages he needs. Being connected directly to the computer, it works without problems.
I think that too many messages receive and the PIC cannot pick out the important ones. Now I tried to filter and mask the messages, so that it is easier for him to find the necessary ones.
My code for masking and filtering:
Code: |
//set mask and filter
can_set_mode(CAN_OP_CONFIG);
RXF0SIDH= 0xA0; //set filter to %101000xxxxx=500+x
RXF0SIDL= 0xFF;
RXM0SIDH= 0xFC; //mask the first 6 bits => 500-519
RXM0SIDL= 0;
can_set_mode(CAN_OP_NORMAL);
RXB0CON = 0x22; //activate filter 0?
|
I tried this configuration in my code, but it doesnot change anything.
Can someone please help me and tell me, what is missing or what is wrong? For configure the can generally I use a library. The code shown above is situated in the main-methode, where the variables are initialized.
I thank you for help. Up to then, pom |
|
|
treanla Guest
|
Config mode ? |
Posted: Wed Mar 30, 2005 5:41 am |
|
|
Have you set the CAN module to be in config-mode when you try to change the mask/filter. |
|
|
Ttelmah Guest
|
|
Posted: Wed Mar 30, 2005 5:51 am |
|
|
Looks like the first line of the code as posted to me...
can_set_mode(CAN_OP_CONFIG);
As far as it goes, what is being done appears proably 'right'. Something like a bus monitor is really needed to see what is happening...
Best Wishes |
|
|
treanla Guest
|
Need glasses now.... |
Posted: Wed Mar 30, 2005 7:22 am |
|
|
Wow....i'm really blind...
|
|
|
Ttelmah Guest
|
|
Posted: Wed Mar 30, 2005 8:24 am |
|
|
It happens.
I have the same problem, you read a post, and 'miss' something that is staring you in the face, then reply to what you are seeing, rather than what is there. I think it is called something like 'being human'....
The problem is that I don't think his difficulty is actually in what is posted. I'd suspect something 'deeper'. For instance, because of the way the arbitration on CAN works, if every idle gap, is already receiving a packet, then a device with a lower priority will be starved. I have a 'nasty feelin', that the busy bus, may be behaving like this...
Best Wishes |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|