Hi all, This is a basic qustion regarding SDA and SCL pins. Since both these pins are bidirectional these should pins need to be tristated , so that the slave can acknowledge on SDA. But i have seen in some docs that a '1' need to be converted to a 'Z' while driving on SDA and SCL, what is the reason behind this???? Thanks in advance, Praveen
Regarding driving of SCL and SDA pins of I2C
Started by ●April 13, 2005
Reply by ●April 13, 20052005-04-13
<praveen.kantharajapura@gmail.com> schrieb im Newsbeitrag news:47cf10b7.0504130430.9a34497@posting.google.com...> Hi all, > > This is a basic qustion regarding SDA and SCL pins. > Since both these pins are bidirectional these should pins need to be > tristated , so that the slave can acknowledge on SDA. > > But i have seen in some docs that a '1' need to be converted to a 'Z' > while driving on SDA and SCL, what is the reason behind this???? > > Thanks in advance, > Praveenwell in order to drive '1' (EXERNAL RESISTIVE PULLUP) you need to Z the wire eg tristate it. 0 is driven as 0 1 is driven (or relased) as Z, ext pullup will pull the wire high Antti
Reply by ●April 13, 20052005-04-13
<praveen.kantharajapura@gmail.com> wrote in message news:47cf10b7.0504130430.9a34497@posting.google.com...> Hi all, > > This is a basic qustion regarding SDA and SCL pins. > Since both these pins are bidirectional these should pins need to be > tristated , so that the slave can acknowledge on SDA. > > But i have seen in some docs that a '1' need to be converted to a 'Z' > while driving on SDA and SCL, what is the reason behind this???? > > Thanks in advance, > PraveenThey're not tri-stated as such, merely a pull down or open collector output, with an external resistive pull-up. If using a micro or FPGA then set the output to a "0" and use the tri-state enable to turn the pin on or off.
Reply by ●April 13, 20052005-04-13
praveen.kantharajapura@gmail.com wrote:> Hi all, > > This is a basic qustion regarding SDA and SCL pins. > Since both these pins are bidirectional these should pins need to be > tristated , so that the slave can acknowledge on SDA.No, both pins are not bidirectional. Only the master device drives the SCK line, and all slaves must leave their SCK's as input.> But i have seen in some docs that a '1' need to be converted to a 'Z' > while driving on SDA and SCL, what is the reason behind this???? > > Thanks in advance, > PraveenAs others have said, usually SCK and SDA have a 1-10k pullup resistor to Vdd. This makes the signal a 1 while no device is pulling a pin low. So set the output pin to a zero, and toggle it as being an input versus an output, to generate your digital signal. Since SCK is never "tristated", you can just drive it as 0/1 output using the master device and omit the pullup resistor. Of course, the master device must be able to source and sink a few mA. The PIC line of microcontrollers have no problem doing this; the Atmels probably work the same. Furthermore, if the Atmels have a pin which is "open collector output only", then that would work for SDA without needing to tristate it. Just set it as an output and "0" will pull SDA low, and "1" will release it (alowing the pullup resistor to make SDA "1".) For power-hungry applications, you can increase the pullup resistors at the expense of speed and noise rejection. 100k works well for shielded, battery-powered applications. Cheers, MCJ
Reply by ●April 13, 20052005-04-13
"Mark Jones" <abuse@127.0.0.1> wrote in message news:upWdnTeAPOxSqcDfRVn-sA@buckeye-express.com...> No, both pins are not bidirectional. Only the master device drives the SCK > line, and all slaves must leave their SCK's as input.Yes, they are. Slaves can pull down SCL to 'wait state' traffic to match their own speed. That's why it has to be open-collector.> Since SCK is never "tristated", you can just drive it as 0/1 output using > the > master device and omit the pullup resistor.No, this is seriously against the spec! You should never drive it active high. Otherwise slaves may be damaged when they try to wait-state the bus master. I've heard this bad advice before - people say they get away with it, but they cannot say it obeys the I2C spec.
Reply by ●April 13, 20052005-04-13
In article <upWdnTeAPOxSqcDfRVn-sA@buckeye-express.com>, abuse@127.0.0.1 says...> praveen.kantharajapura@gmail.com wrote: > > Hi all, > > > > This is a basic qustion regarding SDA and SCL pins. > > Since both these pins are bidirectional these should pins need to be > > tristated , so that the slave can acknowledge on SDA. > > > No, both pins are not bidirectional. Only the master device drives the SCK > line, and all slaves must leave their SCK's as input.Not true, a slave device can extend a cycle through clock stretching and the only way to do that is for the slave device to be able to hold the clock line low. http://www.i2c-bus.org/clockstretching/> > > > But i have seen in some docs that a '1' need to be converted to a 'Z' > > while driving on SDA and SCL, what is the reason behind this???? > > > > Thanks in advance, > > Praveen > > > As others have said, usually SCK and SDA have a 1-10k pullup resistor to Vdd. > This makes the signal a 1 while no device is pulling a pin low. So set the > output pin to a zero, and toggle it as being an input versus an output, to > generate your digital signal. > > Since SCK is never "tristated", you can just drive it as 0/1 output using the > master device and omit the pullup resistor. Of course, the master device must be > able to source and sink a few mA. The PIC line of microcontrollers have no > problem doing this; the Atmels probably work the same. > > Furthermore, if the Atmels have a pin which is "open collector output only", > then that would work for SDA without needing to tristate it. Just set it as an > output and "0" will pull SDA low, and "1" will release it (alowing the pullup > resistor to make SDA "1".) > > For power-hungry applications, you can increase the pullup resistors at the > expense of speed and noise rejection. 100k works well for shielded, > battery-powered applications. > > Cheers, > MCJ >
Reply by ●April 14, 20052005-04-14
James Beck wrote:> In article <upWdnTeAPOxSqcDfRVn-sA@buckeye-express.com>, abuse@127.0.0.1 > says... > >>praveen.kantharajapura@gmail.com wrote: >> >>>Hi all, >>> >>>This is a basic qustion regarding SDA and SCL pins. >>>Since both these pins are bidirectional these should pins need to be >>>tristated , so that the slave can acknowledge on SDA. >> >> >> No, both pins are not bidirectional. Only the master device drives the SCK >>line, and all slaves must leave their SCK's as input. > > > Not true, a slave device can extend a cycle through clock stretching and > the only way to do that is for the slave device to be able to hold the > clock line low. > > http://www.i2c-bus.org/clockstretching/ >Explain that to a Noob. Please.
Reply by ●April 14, 20052005-04-14
Mark Jones wrote:> praveen.kantharajapura@gmail.com wrote: > > Hi all, > > > > This is a basic qustion regarding SDA and SCL pins. > > Since both these pins are bidirectional these should pins need tobe> > tristated , so that the slave can acknowledge on SDA. > > > No, both pins are not bidirectional. Only the master device drivesthe SCK> line, and all slaves must leave their SCK's as input.I do not agree with u mark If a slave can't receive or transmit another complete byte of data until it has performed some other function, for example servicing an internal interrupt, it can hold the clock line SCL LOW to force the master into a wait state.> > > > But i have seen in some docs that a '1' need to be converted to a'Z'> > while driving on SDA and SCL, what is the reason behind this???? > > > > Thanks in advance, > > Praveen > > > As others have said, usually SCK and SDA have a 1-10k pullupresistor to Vdd.> This makes the signal a 1 while no device is pulling a pin low. Soset the> output pin to a zero, and toggle it as being an input versus anoutput, to> generate your digital signal. > > Since SCK is never "tristated", you can just drive it as 0/1 outputusing the> master device and omit the pullup resistor. Of course, the masterdevice must be> able to source and sink a few mA. The PIC line of microcontrollershave no> problem doing this; the Atmels probably work the same. > > Furthermore, if the Atmels have a pin which is "open collectoroutput only",> then that would work for SDA without needing to tristate it. Just setit as an> output and "0" will pull SDA low, and "1" will release it (alowingthe pullup> resistor to make SDA "1".) > > For power-hungry applications, you can increase the pullup resistorsat the> expense of speed and noise rejection. 100k works well for shielded, > battery-powered applications. > > Cheers, > MCJ
Reply by ●April 14, 20052005-04-14
Antti Lukats wrote:> <praveen.kantharajapura@gmail.com> schrieb im Newsbeitrag > news:47cf10b7.0504130430.9a34497@posting.google.com... > > Hi all, > > > > This is a basic qustion regarding SDA and SCL pins. > > Since both these pins are bidirectional these should pins need tobe> > tristated , so that the slave can acknowledge on SDA. > > > > But i have seen in some docs that a '1' need to be converted to a'Z'> > while driving on SDA and SCL, what is the reason behind this???? > > > > Thanks in advance, > > Praveen > > well in order to drive '1' (EXERNAL RESISTIVE PULLUP) you need to Zthe wire> eg tristate it. > 0 is driven as 0 > 1 is driven (or relased) as Z, ext pullup will pull the wire highIn order to drive a '1' , i will not tristate it to 'Z' i will drive a '1' only. Any issues(Hardware malfunction) if i drive a'1' instead of 'Z'> > Antti
Reply by ●April 14, 20052005-04-14
You can read a summary here: http://www.i2c-bus.org/Termination.277.0.html But I recommend visiting the Philips site and downloading the specification: http://www.semiconductors.philips.com/markets/mms/protocols/i2c/ You can probably safely ignore the multimaster and high-speed modes, but you should be aware of their existance. I personally don't know of anybody using high-speed mode, but it does make the I/O requirements more interesting. -Keith






