Can I share an external EEPROM

Started by Floyd Sense May 1, 2009
I have an existing PIC based application and need to add RS232 communications to a PC. Due to timing constraints and other factors, I can't add that code to the existing PIC and intend to do the RS232 work with an additional and separate PIC. What I need is a way to occasionally pass information between the two. I've never used an external EEPROM chip and wonder if there's a way to share access to one EEPROM chip from two different PIC processors?

I don't see why not. The mechanics depend on the EEPROM's interface. If it is I2C then it should be easier because it can handle a multiple master topology out of the box. If it is SPI then you would have weak pull-ups on the lines and both MCU's would go high impedance when not accessing the device. Then when you want to access the EEPROM just check the CS line, be sure its low, then switch the ports to output mode and talk. Set back to inputs when done to release control.

I think the hard part will be in the software to handle collisions on the buss. Like if both MCU's tried to take control at the same exact time... They would both see a floating CS line and then both drive it low at the same time (Collision). One MCU could be a low master and require that the CS line be floating for two counts and the high master only one count. That way if both tried at the same time, the master would take the CS line low after 1 cycle and the low master would check once more, and see the CS line was taken...

I'm sure that others here have actually done this before and know a lot more than I! Personally, I would go with I2C and call it a day.
--- In p..., "Floyd Sense" wrote:
>
> I have an existing PIC based application and need to add RS232 communications to a PC. Due to timing constraints and other factors, I can't add that code to the existing PIC and intend to do the RS232 work with an additional and separate PIC. What I need is a way to occasionally pass information between the two. I've never used an external EEPROM chip and wonder if there's a way to share access to one EEPROM chip from two different PIC processors?
>