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_start() fail

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



Joined: 04 Feb 2009
Posts: 51

View user's profile Send private message Yahoo Messenger

i2c_start() fail
PostPosted: Wed Apr 24, 2013 2:14 am     Reply with quote

Hello.

I have a pickit2 with 16f887 and ds1307.
I used this hardware last time in 2009.
Now, isn't working any more.

Code:
void ds1307_init(void)
{
   BYTE seconds = 0;

   i2c_start();

...

}


Somehow, it creating a infinite loop here (I made a debug), it's never pass from this line:
Code:
i2c_start();


What can be the problem for this? Any ideas?

Thanks.
temtronic



Joined: 01 Jul 2010
Posts: 9221
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Wed Apr 24, 2013 5:27 am     Reply with quote

some ideas...
...assuming the PIC will run a '1Hz blinking LED program

1) no battery on the 1307 ?

2) no I2C bus pullups ?

3) download PCM programmer's I2C 'scanner test program' and see what happens.

If code was working, logic says it's a hardware problem..

hth
jay
pyu



Joined: 04 Feb 2009
Posts: 51

View user's profile Send private message Yahoo Messenger

PostPosted: Wed Apr 24, 2013 6:00 am     Reply with quote

temtronic wrote:
some ideas...
...assuming the pIC will run a '1Hz blinking LED program

1) no battery on the 1307 ?

2) no I2C bus pullups ?

3) download PCM programmer's I2C 'scanner test program' and see what happens.

If code was working, logic says it's a hardware problem..

hth
jay


Thanks for your fast response.

1 - maybe battery is dead. will try another battery. current one is there since 2009, when I worked last time with my pickit2.
2 - I have those 2 resistors. it worked last time in 2009.
3 - where can I find this scanner test program?

Thanks!
Mike Walne



Joined: 19 Feb 2004
Posts: 1785
Location: Boston Spa UK

View user's profile Send private message

PostPosted: Wed Apr 24, 2013 6:13 am     Reply with quote

Quote:
3 - where can I find this scanner test program?

Do a search on this forum

Search for keyword "i2c"
Search for author "PCM programmer"
Set search for ALL terms

Mike
pyu



Joined: 04 Feb 2009
Posts: 51

View user's profile Send private message Yahoo Messenger

PostPosted: Wed Apr 24, 2013 6:55 am     Reply with quote

I think this is it:

http://www.ccsinfo.com/forum/viewtopic.php?t=49713&highlight=i2c

Thanks, I will give it a try Smile
pyu



Joined: 04 Feb 2009
Posts: 51

View user's profile Send private message Yahoo Messenger

PostPosted: Wed Apr 24, 2013 1:06 pm     Reply with quote

I made a test, it crashes on this line:
Code:
status = i2c_write(address);  // Status = 0 if got an ACK


I replace the battery, same problem :(
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Apr 24, 2013 2:28 pm     Reply with quote

Look at the SCL clock line with an oscilloscope. Is it stuck at a low level ?
If so, verify that the pull-up resistor is really connected. Make sure
the ds1307 has power. Remove the ds1307 from the circuit to see
if the test program still locks up.
pyu



Joined: 04 Feb 2009
Posts: 51

View user's profile Send private message Yahoo Messenger

PostPosted: Thu Apr 25, 2013 2:24 am     Reply with quote

Hi.

I re-soldered all the wires and resistors, and now it's working Smile

Thanks.
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