PDA

View Full Version : I2C Max frequency by SPIN



Michael07
01-18-2008, 12:29 PM
Propeller run at 80 MHz.

This is a section in Write Subroutine of I2C_Driver:
T1 := cnt
repeat 8
outa[SDA] := (data <-= 1) & 1 ' Output data to SDA
outa[SCL]~~ ' Toggle SCL from LOW to HIGH to LOW
outa[SCL]~
T2 : = cnt -T1

Result: T2 = 23392 counts (for 8 loops) thus, each loop = 2924 counts
Therefore, SCL = 27.36 kHz (80000000/2924)

If everything is correct, we can not drive I2C device (with 400 kHz clk) by SPIN.

Is there an I2C_driver in Assembly?

Thank you.

Michael

Michael07
01-18-2008, 12:52 PM
Sorry, I just missed the previous post about I2C speeding up. Please ignore this post.

Michael

Mike Green
01-18-2008, 01:24 PM
The I2C routines included with FemtoBasic (downloadable from the Propeller Object Exchange) are written in assembly, can be used separately from FemtoBasic, and will run at 100KHz and 400KHz (selectable).

Beau Schwabe
01-18-2008, 02:29 PM
Michael07 (http://forums.parallax.com/member.php?u=51512),

deSilva had mentioned a site that graphically showed the effects of R and C...

http://www.i2c-bus.org/Termination-versus-Capacitance.530.0.html

To follow up on this I simulated what was on this page and got similar results.
I also changed the parameters so that the I2C voltage level was 3.3V and the SCL line was at 400KHz.

Based on this information, at 400KHz I would probably use a 1K to 2.2K pullup resistor leaning more towards the 1K.

http://forums.parallax.com/attachment.php?attachmentid=51522





▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe (mailto:bschwabe@parallax.com)

IC Layout Engineer
Parallax, Inc.

Post Edited (Beau Schwabe (Parallax)) : 1/18/2008 6:36:06 AM GMT

deSilva
01-18-2008, 05:30 PM
Beau, I always appreciated your "experimental" mind! It is good to see signals on the 'scope!
Also, there is always a difference between 3V and 5V supply (to the worse, alas!) that we tend to forget when having figures from the "old time" in our mind http://forums.parallax.com/images/smilies/smile.gif

My problem is still that I cannot explain where 150pF should come from on a soldered board...

Post Edited (deSilva) : 1/18/2008 9:35:27 AM GMT

Don D
01-18-2008, 09:49 PM
Not for the faint hearted, but generally informative on this topic:

http://lsiwww.epfl.ch/LSI2001/teaching/webcourse/ch04/ch04.html

mynet43
01-18-2008, 11:22 PM
I also tracked down deSilva's link.

I found the attached charts which show pull-up resistance as functions of bus capacitance and also supply voltage.

This would support Beau's recommendation of 1K pull-up, although that is at the absolute minimum allowed for 3.3V supply.

It might be safer to go a little higher.

Jim