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 CCS Technical Support

can_set_mode problem in can18fxx8.c driver.

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



Joined: 11 Nov 2007
Posts: 5

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

can_set_mode problem in can18fxx8.c driver.
PostPosted: Wed Dec 05, 2007 2:48 pm     Reply with quote

The set_can_mode function goes like this:

Code:

void can_set_mode(CAN_OP_MODE mode){


        CANCON.reqop=mode;
   while( (CANSTAT.opmode) != mode );

}


Sometimes, when I call set_can_mode (CAN_OP_CONFIG); the function freezes, I guess the while expression inside the function remains true no matter if the CANCON.reqop=mode instruction its been executed. The CANSTAT reg should change but it doesn't.

So what it is happening?

regards

P.D. pic18f258 + ccs compiler 3.232
_________________
Julián Andrés Guarín
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Dec 05, 2007 3:11 pm     Reply with quote

I've never heard of this bug, but here is a post where they say to
put it in Loopback mode before going to Config mode.
http://osdir.com/ml/hardware.bus.can/2003-11/msg00003.html

In other words, he is saying to do this:
Code:

can_set_mode(CAN_OP_LOOPBACK);
can_set_mode(CAN_OP_CONFIG);
jguarin2002



Joined: 11 Nov 2007
Posts: 5

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

PostPosted: Wed Dec 05, 2007 7:57 pm     Reply with quote

Yes but Im trying to go from normal op to config op. Besides Im usign 18f258 that issues a built-in can module no need for 2515 can host.

So it is different that topic. But thanks anyway.

What its very sad is that this was not happening at all (same code for 2 week worked ok, and after that, without making any change it suddenly does not work anymore). The problem with this is that I cant set filters any more... (well one among the the rest).


Could anyone please try to figure it out, what's going on?. Is there a built in problem with this MCUs? Its incredible strange... i try to compile other porgrams that use the filtering feature amd they did not workl! again the op_config_mode part!!!!!! Help!.


When I do

CANCON|=80; REQOP2 is in 1 thus requesting config mode.

CANSTAT should be in 80 confirming the config state. But it never changes!.

Help please! Anyone!
_________________
Julián Andrés Guarín
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