PDA

View Full Version : Multiple Pics accessing single EEPROM



Atom058
- 2nd February 2008, 20:30
Hello - I have been pouring over posts here for hours and have not come across anyone discussing thisparticular problem, so I tought I'd toss it out there. I am working on a design that has a "Master" PIC and 6 "Slave" PICS and a single I2C EEPROM. The Master stores data on the EEPROM and, when triggered, the Slaves, one at a time, go to the EEPROM and read the data. The way my circuit is set up is that all PICs share the SCL and SDA lines. This all works just fine if I just have one Master and one Slave. As soon as I plug in a second Slave, the data that I am writing to the EEPROM from the Master becomes corrupted. To try to figure out what was going on, I wrote a simple program for the Master that writes a number to EEPROM and then reads it back and displays it on an LCD. With one Slave installed, I can write the number (i.e., 543) to EEPROM and read it back just fine (the slave is not doing anything - just is installed in the circuit). As soon as I plug in another Slave, I get 8224 back (no matter what number I try to write out). I am assuming that the additional pics might be "drawing down" on the circuit causing the EEPROM to malfunction. On a huntch, I lowered the two 4.7K pullup resistors on the EEPROM to 2.2K, but no change. Can anyone shed some light on what I am seeing?

Thanks!

skimask
- 2nd February 2008, 23:20
I assume you're using the I2CREAD and I2CWRITE commands in PBP?
When each PIC is done reading/writing the EEPROM, add some code to manually set those pins back to INPUTs (input sda, input scl) immediately after the read or write. With the pins set as inputs, it would be as if they weren't even there. I think about the only thing you'd have to worry about would be read/write collisions.

Atom058
- 3rd February 2008, 17:05
Skimask - Yes, I am using I2CREAD/WRITE in PBP. Thanks for the suggestion - I will give it a try and post my results.

Thanks again!

Atom058
- 3rd February 2008, 17:22
Skimask - Works perfectly! I now have 1 Master and 6 Slave PICs sharing the same EEPROM. As for collision, I just put in a delay for each Slave, incremented by 50 mS, before I change the 2 pins to outputs, read the data and then change them back to inputs.

Thanks!
Atom058