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

I2C NACK Avoidance and Recovery

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



Joined: 20 Jun 2008
Posts: 4

View user's profile Send private message

I2C NACK Avoidance and Recovery
PostPosted: Thu May 21, 2009 3:13 am     Reply with quote

Hi.

I amd working on a project, programming a PIC18F4685 as master, interfacing with a DS1337 RTC, a 24LC256 EEPROM and a PIC16F886 by I2C.

I am using slow, software mode.

Code:

#use I2C(MASTER,sda=PIN_C4,scl=PIN_C3,slow)


The RTC and EEPROM work perfectly, but the PIC communication frequently locks up. I tried to handle the ACK/NACK, but can't find a way to unlock the communication without a hard reset on both PICs.

Can anyone give me some hints on how to avoid these lockups and how to recover without resetting the PICs, should they occur?

I am also in doubt as to clock stretching. Is this a hardware function, or does it have to be implemented by software? If so, how is CCS, should it be done?

Thank you
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun May 24, 2009 5:12 pm     Reply with quote

Disconnect all slave devices except the 16F886. Edit your Master code
so it only talks to the 16F886. Does it now work ?

If it fails, then post a small but complete test program for both Master
and Slave. The programs must be small. Each program should take
up less than one screen in an editor. The smaller they are, the easily
the problem can be spotted.
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