I2C & SPI implimentation
yarisboy
Posts: 245
in Propeller 1
My schematic for the Prop 1 EEPROM (24LC256) shows address pins A0,A1, and A2 tied to ground. The 24LC256 spec says the EEPROM will work with all three high or all three low. I have an application where I need to use three MCP3208s. Can all four chips share the same clock and data lines? I would have three chip select lines to the MCP3208s (one each). If those three lines share with A0,A1,& A2 of the EEPROM can a normal boot be done and still communicate with the individual MCP3208s when data is needed? Depending on pin status of the Prop at boot time it looks like I'd need either three pull down resistors or three pull up resistors on A0,A1, & A2 of the 24LC256. 24 channels of analog A/D and 24 control outputs is a squeeze on the Prop 1.
Comments
I'm nor sure why you need to connect/change A2..A0, but you could look at the EFM8LB1/ EFM8BB3 MCU I mentioned in another thread for an i2c 12b or 14b ADC (+DACs).
20 IP's and up to 1MSPS 3v3 only tho, and you do need to pgm it.
A0, A1 and A2 are "Address Select" lines and best thought of as part of the EEPROM. How they're set, i.e. what voltage each pin on each chip is connected to sets its address. Section 5 of the datasheet explains this. The "device control code" is binary 1010. By writing the control code, then A2 | A1 | A0 address and such to the I2C bus, you control which chip is responding when talked to.
So for instance you could wire:
- Chip 1 has all 3 tied to ground. < default for 1st / boot EEPROM on prop board
- Chip 2 has A0 tied to 3v3, and A1 and A2 tied to ground.
- Chip 3 has A0 and A1 tied to 3v3, and A2 tied to ground.
- Chip 4 has all 3 tied to 3v3.
For the above devices they would be identified as (all as binary):
Chip 1 = 1010000
Chip 2 = 1010001
Chip 3 = 1010010
Chip 4 = 1010111
If you want to share the the I2C pins with the SPI pins for the MCP3208s then use the I2C pins for chip selects. As long as only one of them is low, the EEPROM will not detect any valid command.
You will need another 3 pins for the SPI communication and another one for a third CS, so you have 24 pins free for digital outputs.
Andy