Haveing just done the same things you did, I know the feeling. Took me a couple days to get all the timeing right, etc. Only thing I think of is the LED's themselves. Are they buffered? I don't know what the capacitance is on a LED but could it be slowing down the bus? Roman Black wrote: > Well i'm I2C embarrased! :o) > After weeks of downloading and printing all the > Microchip appnotes, and the F873 and 24LC256 > datasheets, with all been read at least once and > handwritten notes through them, and I2C timing > diagrams up on my wall, and downloading all the > piclist.com I2C source code, and thinking I knew > just about all the secrets to bit-banging I2C to a > serial eeprom, well... It doesn't work. > > Yes i've checked appnote AN709 and used their > safety initialisation example. I've allowed around > 2uS between any change of state of the SDA or SCL > pins, to keep rise/setup/hold times all safely > well within spec. I disable GIE (with the safe loop) > before doing any I2C stuff. > > Hardware? I have 3 indicator leds, one flashes > the data bytes, others to confirm the write or read > control buttons. It is on a "protoboard" that I use > for projects that is kitted with it's own ICSP. > I have a 1k pullup resistor on SDA. Speed is 16MHz, > or 4MHz/inst. > > Everything is designed in small simple code modules > that I have checked carefully. > > Here's my problem: > * about 10% of the time the ack bit (from eeprom) > fails, ie my code detects ack was high after sending > 8 bits. Any read or write to the 24LC256 eeprom > must send at least 3 bytes and receive back 3 acks, > for control, address_hi and address_lo. > * If it manages a read or write without failing an ack > the eeprom read comes back as all zeros. I'm assuming > that no valid write (and possibly no valid read) is > ever taking place. > > Any suggestions? This is embarassing, after all the > I2C problems posted here I was determined to do my > homework first and get it right... :o) > -Roman > > -- > http://www.piclist.com hint: PICList Posts must start with ONE topic: > [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads