I stand corrected, forgot about clock stretching, probably because I've never used a device that did it. TTYL > -----Original Message----- > From: pic microcontroller discussion list > [mailto:PICLIST@MITVMA.MIT.EDU]On Behalf Of Barry King > Sent: Wednesday, March 14, 2001 16:52 > To: PICLIST@MITVMA.MIT.EDU > Subject: [PIC]: I2C pullups > > > > I'm relatively certain that slaves do NOT drive SCL, mainly because if > > you had a locked up slave holding SCL low it would prevent ANY > communication > > on the bus. > > By the spec, slaves MAY drive SCL low, which is called clock > stretching. The purpose is that a slow slave can hold SCL low, after > the master has released it, until the next bit is ready. The Master > must wait for the actual rising edge to know the bit is valid. > > I have never seen a slave implementation that USES clock stretching > (example: EEPROMs don't) EXCEPT one that's important to us: PIC's SSP > in slave mode. As a slave, it ALWAYS pulls SCL low from the time it > recognizes its slave read address, until the first byte of the > response is loaded by the firmware. > > So it you are using a PIC as a slave, follow the spec, and provide > pullups on both lines, and make sure the master is operating "open- > drain", that is, pull down when presenting a low, and float the line > and let the pull up present the high level. > > > I'm relatively certain that slaves do NOT drive SCL, mainly > because if > > you had a locked up slave holding SCL low it would prevent ANY > communication > > on the bus. > > TRUE. If you write I2C slave code for a PIC, you've got to be darn > careful that you always respond to the SSPIF, even if you don't > "think" the master wants any more data now. The SSP WILL lock the > bus if you leave a slave-read (PIC slave sends data to master) > transfer unfinished. > > -Barry. > ------------ > Barry King > NRG Systems "Measuring the Wind's Energy" > http://www.nrgsystems.com > Check out the accumulated (PIC) wisdom of the ages at: > PIC/PICList FAQ: http://www.piclist.com/faq > > -- > http://www.piclist.com hint: The list server can filter out subtopics > (like ads or off topics) for you. See http://www.piclist.com/#topics > > > -- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics