Shop OBEX P1 Docs P2 Docs Learn Events
I2C & SPI implimentation — Parallax Forums

I2C & SPI implimentation

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

  • jmgjmg Posts: 15,148
    yarisboy wrote: »
    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?

    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.

  • SDA and SCL can be shared between all 4 chips, with a pull-up on each. One downside is you can only read or write to one chip at a time this way. If you need to talk to multiple chips simultaneously, i.e. with different COGS, they'll each require their own SDL/SCL connections and pull-ups.

    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
  • I2C uses device specific adresses, SPI uses chip select lines. If you're communicating with I2C (as the EEPROM does) you can share any devices on the same lines as long as they have different addresses. Their addresses will be in the data sheets, and often configurable with external connections pulled up/down.
  • AribaAriba Posts: 2,682
    edited 2015-11-30 08:41
    You don't need to do anything with A0..A2 of the EEPROM, just connect them to ground.
    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
    359 x 420 - 11K
  • abecedarianabecedarian Posts: 312
    edited 2015-11-30 09:29
    Wow... I feel stupid yet again, somehow missing the MCP3208's.
  • Ariba wrote: »
    You don't need to do anything with A0..A2 of the EEPROM, just connect them to ground.
    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

Sign In or Register to comment.