OK, I have written it and am testing it. I also included: when changing the SD state to a HIGH, the SD pin is then tested to make sure it really floated high; if it somehow did not, set an ERROR flag and force the master to REDO that pass, but before allowing it to proceed, execute the SC HIGH then LOW for 9 cycles, because all I2C devices will release the bus after 9 clock cycles (unless the device is defective). I'll keep you guys posted. --Bob On 6/23/09, Bob Axtell wrote: > another good idea. Thanks, Mike! > > On 6/23/09, Michael Rigby-Jones wrote: >> >> >>> -----Original Message----- >>> From: piclist-bounces@mit.edu >>> [mailto:piclist-bounces@mit.edu] On Behalf Of Bob Axtell >>> Sent: 23 June 2009 18:42 >>> To: pic microcontroller discussion list >>> Subject: [PIC] Unusual [bit-banged] I2C problem >>> >>> I am bewildered by an IC2 problem that I've never seen >>> before. After a month of tinkering, I am throwing it out to >>> the PICLIST experts. >>> >>> The precise problem is that the firmware is occasionally >>> writing 8 zeros into the I2C serial device instead of reading >>> 8 bytes. What makes that so astonishing is that no "I2C >>> write" code is present _anywhere_ in the firmware!! The >>> occurence is approx 1 in 25000 trials. >> >> Are you actually seeing the master address the the slave for writing >> (i.e. R/W=0) or are you just seeing 8 consecutive zero bytes on the bus? >> >> If the slave device is somehow getting latched up then it could >> potentially be asserting the SDA line low, which the master can not >> over-ride. Do you see any of the signal lines swing outside of the >> supply or ground rails at the EEPROM during operation? >> >> Alternatively, the relatievly unprotected PIC pin might be unhappy >> driving such a long length of wire. Some schotky diodes from the SDA >> pin to the supply rails to clamp any transients might not be a bad idea, >> better still use one of the bus extenders designed for driving long I2C >> lines. >> >> Regards >> >> Mike >> >> ======================================================================= >> This e-mail is intended for the person it is addressed to only. The >> information contained in it may be confidential and/or protected by >> law. If you are not the intended recipient of this message, you must >> not make any use of this information, or copy or show it to any >> person. Please contact us immediately to tell us that you have >> received this e-mail, and return the original to us. Any use, >> forwarding, printing or copying of this message is strictly prohibited. >> No part of this message can be considered a request for goods or >> services. >> ======================================================================= >> >> -- >> http://www.piclist.com PIC/SX FAQ & list archive >> View/change your membership options at >> http://mailman.mit.edu/mailman/listinfo/piclist >> > -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist