This is just a stab in the dark, since you seem to have done your homework... according to the datasheet, the maximum allowed risetime is 1000ns (1us), whereas the maximum allowed fall time is 300ns. Have you looked at the lines with a scope? -----Original Message----- From: Roman Black [mailto:fastvid@EZY.NET.AU] Sent: Monday, May 07, 2001 2:23 PM To: PICLIST@MITVMA.MIT.EDU Subject: Re: [PIC]: [EE]: I2C embarassed!! Mark Newland wrote: > > 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? Thanks Mark, the leds are on different pins and not on the I2C bus. I know the protoboards have about 50pF per "row" so I may have as much as 100pF on either SDA or SCL, but I thought 2uS would be enough. I tried it with a 4MHz crystal instead, so that took it to 8uS between any state change of a bus pin. Identical fault symptoms. I'm stumped. -Roman > 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 -- 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