Two PICAXE i2c Masters - One i2c EEPROM

rs2845

Senior Member
Hi everyone,

Been doing some searching all morning and can't find a definite answer. So I am building an alarm system. One PICAXE chip (40X2) acts as the main brains which is used on the control panel, all configuration data/settings for my system are stored in a 24LC512 EEPROM. I also have another PICAXE which is responsible for connecting to a PC via serial and my software monitors/configures the system by changing the data in the 24LC512 EEPROM. The reason why they are in separate chips is that I have reached the program size limit in the 40X2.

As it's all still in development, I have only had the i2c bus of each PICAXE connected to the EEPROM separately. What would happen if I connected both PICAXE chips (both i2c masters) to the EEPROM at the same time? Could it cause damage? If I made sure that one PICAXE couldn't access the EEPROM whilst it was already in use by the other then this would prevent data corruption and lockups. I am just worried about the voltages from one chip going into another chip.

These PICAXE chips must both use the same EEPROM and one PICAXE cannot feed data into the other. They both need their own independent access to the EEPROM.

What is the best way to accomplish this?
 
Last edited:

nick12ab

Senior Member
PICAXE does not support multi master but all i2c bus devices are open drain so the PICAXEs cannot damage each other by being connected at the same time.

However you still need to prevent both PICAXEs from trying to access the EEPROM at the same time. Two I/O lines between the PICAXE could be used, each PICAXE having one input and one output. When a PICAXE wants to access the EEPROM, it checks for a busy signal from the other PICAXE first. It activates its own busy signal, then there's a short delay (in case both PICAXEs were to try to access the EEPROM at the same time) before checking for the other PICAXE's busy signal again and then accessing the EEPROM.
 

westaust55

Moderator
An X1 or X2 PICAXE can also be. I figured as an i2c slave (even slave to an M2 part).
Can you set an PICAXE as a slave then use a flag if necessary so the remaining master knows when to send or receive data via i2c?
 
Top