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

problem with i2c comunication

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



Joined: 22 Aug 2005
Posts: 275

View user's profile Send private message

problem with i2c comunication
PostPosted: Mon Mar 26, 2007 11:06 am     Reply with quote

Hi Everybody,

I'm in trouble with i2c. Only In case of noise the micro stay inside i2c function till wdt timeout.

Is there any way to introduce a timeout on i2c routine to exit before wdt timeout ?
Shall I edit i2c function to do some change ?


Thanks for help and only suggestion about,

Regards,
Fabri
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Mar 26, 2007 2:04 pm     Reply with quote

Look at Mark's i2c master code in the Code Library.
http://www.ccsinfo.com/forum/viewtopic.php?t=22105
He has an example of how to handle a i2c bus timeout.
Look for this variable in his code, to find the sections on timeouts:
Quote:
I2C_Bus_Timeout



Also, for information on hardware fixes for i2c bus noise,
search for this string on Google:
Quote:
i2c noise OR noisy

Example:
http://focus.ti.com/lit/an/slea053/slea053.pdf
Fabri



Joined: 22 Aug 2005
Posts: 275

View user's profile Send private message

PostPosted: Mon Mar 26, 2007 2:55 pm     Reply with quote

Hi PCM,

Thanks for suggestion.

I belive the problem is in software because in #use_i2c there's a test of end of transmission/reception (PIR1,SSPIF) so in case of problem the micro stay in loop till timeout reset occure. At the moment I'll try so solve the problem without rewrite i2c comunication routine.

I've a timer0 interrupt service so I think to set SSPIF manually when timeout occured after i2c operation, just to exit from routine before wdt timeout.

do you think is good way ?
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