Pages

Sunday, May 12, 2013

RPi I2C/SPI slave device address decoding design notes
























I have been confused by the RPi's I2C and SPI device address decoding methods.  So let me make a summary.

*** I2C

1. In Raspberry Pi, there are 2 I2C buses, I2C0 and I2C1.  For now I have been using I2C1 at the P1 header.  I2C0 is at the P5 header and I have not tried it.

2. For MCP230xx, each chip has 3 address pins A2, A1, A0 to select 8 devices.  In other words, I2C0 can entertain 8 devices, I2C1 8 devices, altogether 16 devices.

*** SPI

1. In Raspberry Pi, there is only 1 SPI bus.  This SPI bus have one chip has 2 select lines CE0, CE1, so can select 1 or 2 devices.

2. For MCP23Sxx, each chip also has 3 address pins A2, A1, A0 to select 8 devices. So SPI also altogether can select 1 of 16 devices.

*** Guzunty Pi

1. For Guzunty Pi, there is only one device select pin, by default wired to RPi's CS0.  There are no address select pins.  In other words, without additional hardware, SPI can select only 1 or 2 GPis.

*** Microchip ADC, Digital Potentiometer, and EEPROM

Microchip's ADC, Digital Pot, and EEPROM also only has CS pin but no extra address pins, therefore only 1 of 2 devices can be selected if no additional decoding hardware is used.

Now I am thinking of doing the following.

1. Use 1 MCP23S17 as the additional address decoder.

2. MCP230S17's 16 ports can all be assigned to be output.  Therefore 16 devices can be selected.  In other words, the total number selectable devices is multiplied by 16, or 256 devices.  Actually only 255 devices because this first MCP23S17 is already  used for decoding.

If using 1 of 8 address decoders such as 74HC138/137 3 line to 8 line 1 of 8 selectors, then the total number becomes roughly (16 - 1) * (16 / 3) * 8 ==  680 devices, to many for human to handle!

Now I am going to make my first MCP23S17 address decoder board.

.END







No comments:

Post a Comment