Hi all -
Has anyone had any experience with using multiple I2C devices is a bus architecture?
I am using a PIC18LF252 uC, a 24LC256 serial EEPROM, and three Dallas DS1803 dual 100K programmable pots in a bus. The circuit is on a printed circuit board (not wire-wrapped or breadboarded). The total length of SDA and SCL lines is about 3 inches.
I'm using the CCS C compiler with built-in I2C functions for I2C start, stop, write, and read. I had to write my own routines to handle the DS1803 device specifics. I breadboarded a single DS1803 with some test code using the routines to verify correct operation. It seemed to work well. When I put the three DS1803 chips in the circuit, along with the memory chip though, it gives erratic results.
I looked at the SDA and SCL on a logic analyzer and found out why it was erratic. Every other time I executed a read instruction, the SDA line stayed low (did not output the stop condition). The following command fails but resets the SDA line high again so the next instruction following works again. This repeats indefinitely. Every other read works. The write cycles seem to be OK so I thought it must be timing related. The DS1803 reads both pot values sequentially and I thought the data on the second read was being output too soon or something. I inserted small delays (about
10ms) between byte reads in the sequence. No help. I added a second stop after the first stop (thinking at least one would get through). That made matters worse.I've varied the size of the pullup resistors from 1.2K to 4.7K. No value made it work completely, although some values seemed to work a little better than others (around 2.0K to 2.2K worked the best). One DS1803 and the memory seem to work almost all the time while the other two DS1803s exhibit this toggling-read symptom. The daisy-chain for the bus goes from memory-to-PIC-to-DS1803A-to-DS1803B-to-DS1803C. DS1803B is the one working most of the time while A and C toggle.
Does anyone have any idea what's happening or what I may not have considered?
TIA
Dave