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 timeout for master

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



Joined: 07 May 2004
Posts: 263

View user's profile Send private message

I2C timeout for master
PostPosted: Mon Jan 21, 2008 11:43 am     Reply with quote

I'm using an 18F452 that talks I2C to other devices. I was testing with nothing attached and noticed that with no slave attached the master locks up when it tries to write.

Here is the relevant code
#use I2C(master, sda=PIN_c4, scl=PIN_c3,slow)

i2c_start(); // restart condition
i2c_write(address);//address
i2c_write(16);//P is 16th letter
i2c_write(20);//pwm
i2c_write(0);//dir
i2c_write(20);//pwm
i2c_write(0);//dir
i2c_stop();

Is this normal? If so is there an easy way to make so I can test with nothing attached?

Thanks
Ringo
_________________
Ringo Davis
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Jan 21, 2008 12:16 pm     Reply with quote

You probably don't have pull-ups on the master side. If you have
pull-ups, the master won't lock up with your test code, even though
there is no slave.
Ringo42



Joined: 07 May 2004
Posts: 263

View user's profile Send private message

PostPosted: Mon Jan 21, 2008 12:52 pm     Reply with quote

I'll check tonight. The board is mostly populated, so it is possible I forgot to put them on.
Thanks
Ringo
_________________
Ringo Davis
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Jan 21, 2008 12:55 pm     Reply with quote

Or, you might only have pull-ups on the detachable slave board. If so,
you could add some light pull-ups on the master board (such as 10K).
They would pull up the i2c lines when the slave is detached.
Ringo42



Joined: 07 May 2004
Posts: 263

View user's profile Send private message

PostPosted: Mon Jan 21, 2008 1:06 pm     Reply with quote

The pads for the pullups are on my master board, but I might not have populated them yet. I'm assembling and testing at the same time, so I might have skipped over them.
Thanks

Ringo
_________________
Ringo Davis
xa4



Joined: 04 Jun 2008
Posts: 9

View user's profile Send private message Visit poster's website

PostPosted: Wed Oct 29, 2008 9:39 am     Reply with quote

Greetings,

I have the same problem as Ringo but the pullup resistors (4k7) are present on my master circuit board..

Any ideas ?

Thank you !
_________________
Best,
Xavier Righetti - http://xa4.ch
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Oct 29, 2008 3:13 pm     Reply with quote

1. Post the manufacturer and part number of the i2c chip that you are using.

2. Post a link to a schematic of your board (if possible).

3. Post a very small program that shows the problem.

4. Post your CCS compiler version.
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