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
Posted: Mon Mar 26, 2007 2:04 pm
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:
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.
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