|
|
View previous topic :: View next topic |
Author |
Message |
miko
Joined: 29 Nov 2003 Posts: 3
|
CAN 18f2*8 Problem |
Posted: Fri Dec 19, 2003 12:54 pm |
|
|
Hello,
can anybody tell me why the 18f258 dont get a standard-message if i set the RXBxCON-Registers to CAN_RX_VALID (0x00) or CAN_RX_STD (0x01)?
It will only recieve Standard-Messages at CAN_RX_ALL (0x03), otherwise the RXBxCON.rxful bit will not be set.
thanks miko |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Dec 19, 2003 2:54 pm |
|
|
I haven't tested this in hardware, but I believe this is the reason:
If you look at this file, can-18xxx8.c, in the can_init() function,
all of the calls to can_set_id() have the 3rd parameter set to 1.
This means they are setting up an extended ID, not a standard one.
Because of that, they are also setting the EXIDE bit in RXFnSIDL.
See this line in can_set_id():
*ptr |=0x08;
According to page 3 of AN739, if that bit is set, the CAN module will
filter on extended IDs, and reject all standard IDs. (AN739 is for
the MCP2510, but the CAN module in the 18F458 is similar).
[Edited to add: If you look in the 18F458 data sheet, in section 19.5.3
it makes a similar comment about the EXIDE bit and standard messages]
So, I think, if you want to use standard IDs, you need to edit the
the can_set_id() function in can-18xxx8.c, and change the 3rd
parameter to 0, in every call to can_set_id().
I haven't tested this. I have only used the CCS code with extended
IDs. However, during testing we tried it with standard IDs and
observed the same problem that you found (and the same temporary
solution). I didn't pursue the problem any further because our
application needed to use Extended IDs anyway. But since you're
using Standard IDs, maybe the ideas I gave above can help you. |
|
|
miko
Joined: 29 Nov 2003 Posts: 3
|
Thank You |
Posted: Tue Dec 23, 2003 4:29 pm |
|
|
PCM programmer wrote: | I haven't tested this in hardware, but I believe this is the reason:
If you look at this file, can-18xxx8.c, in the can_init() function,
all of the calls to can_set_id() have the 3rd parameter set to 1.
This means they are setting up an extended ID, not a standard one.
Because of that, they are also setting the EXIDE bit in RXFnSIDL.
See this line in can_set_id():
*ptr |=0x08;
According to page 3 of AN739, if that bit is set, the CAN module will
filter on extended IDs, and reject all standard IDs. (AN739 is for
the MCP2510, but the CAN module in the 18F458 is similar).
[Edited to add: If you look in the 18F458 data sheet, in section 19.5.3
it makes a similar comment about the EXIDE bit and standard messages]
So, I think, if you want to use standard IDs, you need to edit the
the can_set_id() function in can-18xxx8.c, and change the 3rd
parameter to 0, in every call to can_set_id().
I haven't tested this. I have only used the CCS code with extended
IDs. However, during testing we tried it with standard IDs and
observed the same problem that you found (and the same temporary
solution). I didn't pursue the problem any further because our
application needed to use Extended IDs anyway. But since you're
using Standard IDs, maybe the ideas I gave above can help you. |
thank you, it works
i set the first mask and filter to Standard IDs and the second Filter to Extended IDs. The second mask and the other filters i set to Extended IDs so i can receive standard and extended Messges.
pleese excuse me bad english.
i wish you and all others MERRY CHRISMAS AND A HAPPY NEW YEAR
miko |
|
|
|
|
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
|