CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

CAN 18f2*8 Problem

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
miko



Joined: 29 Nov 2003
Posts: 3

View user's profile Send private message Send e-mail

CAN 18f2*8 Problem
PostPosted: Fri Dec 19, 2003 12:54 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Fri Dec 19, 2003 2:54 pm     Reply with quote

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

View user's profile Send private message Send e-mail

Thank You
PostPosted: Tue Dec 23, 2003 4:29 pm     Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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