I2C Max frequency by SPIN
Michael07
Posts: 12
Propeller run at 80 MHz.
This is a section in Write Subroutine of I2C_Driver:
T1 := cnt
repeat 8
outa[noparse][[/noparse]SDA] := (data <-= 1) & 1 ' Output data to SDA
outa[noparse][[/noparse]SCL]~~ ' Toggle SCL from LOW to HIGH to LOW
outa[noparse][[/noparse]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
This is a section in Write Subroutine of I2C_Driver:
T1 := cnt
repeat 8
outa[noparse][[/noparse]SDA] := (data <-= 1) & 1 ' Output data to SDA
outa[noparse][[/noparse]SCL]~~ ' Toggle SCL from LOW to HIGH to LOW
outa[noparse][[/noparse]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
spin
13K
Comments
Michael
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.
·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
Post Edited (Beau Schwabe (Parallax)) : 1/18/2008 6:36:06 AM GMT
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
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
http://lsiwww.epfl.ch/LSI2001/teaching/webcourse/ch04/ch04.html
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