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

I²C speed limit

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



Joined: 08 Sep 2008
Posts: 84

View user's profile Send private message

I²C speed limit
PostPosted: Sat Apr 04, 2009 5:31 am     Reply with quote

Hi,


I used the code below and add FAST=400khz, to both slave and master #use i2c () directive, code but the communication blocked in 400khz (but worked for 390khz and lower)

http://www.ccsinfo.com/forum/viewtopic.php?t=36695

I can work at frequency lower than 400 khz, but , if possible, I would like to know why 400khz is not possible to use. Is this frequency just theoric ?


any idea ?

thanks.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sat Apr 04, 2009 12:15 pm     Reply with quote

You didn't say what PIC you are using, but in many PIC data sheets,
there is a statement that the timing at 400 KHz does not meet the i2c
specification, and the "care should be used" at that frequency.

Tell us what PIC you are using, and also your compiler version.
Ttelmah
Guest







PostPosted: Sat Apr 04, 2009 2:48 pm     Reply with quote

Also what clock rate the PIC is running.

With some PIC's 400K, most certainly can work, but it does require low bus capacitances, low pull up resistors, and a fast master clock.

Best Wishes
Salenko



Joined: 08 Sep 2008
Posts: 84

View user's profile Send private message

PostPosted: Sun Apr 05, 2009 4:40 am     Reply with quote

Hi PCM & Ttelmath,

thank you very much for your answers, Smile

the master is a 16F877 PIC micro running at 20Mhz
the slave is a 16F876 PIC micro running at 10Mhz

my compiler is PCW 4.057


the master and the slave are placed in different boards (distance between them is about 12 inch ), besides, the master has two slaves in his board (an RTC and an EEPROM ) that's why I think I need a fast communication (but not necessary as fast as 400khz) , because the master has to stock data every minute in the EEPROM and get real time from the RTC (in addition to sending/receiving data to/from the 16F876 Micro but, this is not so frequent).

the pull-up resistances am using are 4.7k.

what do you think the approriate I2C speed to use ?, the resistance values ?, should I change the quartz ?.

thank you.
Ttelmah
Guest







PostPosted: Sun Apr 05, 2009 2:34 pm     Reply with quote

Reduce the resistors. At 400KHz, 4K7, limits you to a total bus capacitance of about 60pF. Add the pins on the chips, and your cabling, you may well be over this. 2K, is a more normal high speed value.
Realistically, I2C, is always easier, and more reliable if the slave is running at least as fast as the master.
Check the data sheets for your chips.

Best Wishes
bsturm



Joined: 23 Feb 2009
Posts: 29

View user's profile Send private message

PostPosted: Mon Apr 06, 2009 9:33 pm     Reply with quote

I have a very similar application and I use slow I2C. It seems plenty fast to me and hopefully more reliable than fast I2C. I do have a slightly longer cable (~36") to my slave board. I also have 4k7 pullups at both ends. I had to add some delays to give the slave time to process, I don't think the clock stretching was working for me. You can find my recent posts for examples. In general, I always try to use the slowest possible communication rates.
Salenko



Joined: 08 Sep 2008
Posts: 84

View user's profile Send private message

PostPosted: Wed Apr 08, 2009 7:49 am     Reply with quote

Ttelmah wrote:
Reduce the resistors. At 400KHz, 4K7, limits you to a total bus capacitance of about 60pF. Add the pins on the chips, and your cabling, you may well be over this. 2K, is a more normal high speed value.
Realistically, I2C, is always easier, and more reliable if the slave is running at least as fast as the master.
Check the data sheets for your chips.

Best Wishes


thanks Ttelmah Wink
Salenko



Joined: 08 Sep 2008
Posts: 84

View user's profile Send private message

PostPosted: Wed Apr 08, 2009 7:51 am     Reply with quote

bsturm wrote:
I have a very similar application and I use slow I2C. It seems plenty fast to me and hopefully more reliable than fast I2C. I do have a slightly longer cable (~36") to my slave board. I also have 4k7 pullups at both ends. I had to add some delays to give the slave time to process, I don't think the clock stretching was working for me. You can find my recent posts for examples. In general, I always try to use the slowest possible communication rates.

thank you bsturm, I'll take a look at your posts. Wink
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