user33150: I would like to use 7 MCP23S17 as output expanders on one SPI bus. Every IC has its own address from 0 to 6. The first MCP23S17 can be written with no problem. The second chip did not work properly. The CS pin of the MCP23S17 is set like at the all other 4 ICs.
Does anybody have experience with more then 4 MCP23S17 on SPI? Could anyone help?
#include <SPI.h>
#include <MCP23S17.h>

MCP A(0, 10);
MCP B(1, 8);
int d = 250;

void setup() {
  A.begin();
  B.begin();
  for (int k = 1; k <= 16; k++) {
    A.pinMode(k, OUTPUT);
    B.pinMode(k, OUTPUT);
  }
}

void loop() {
  //////////// ON THE LIGHT ONE BY ONE  FROM BEGGING
  for (int f = 1; f <= 16; f++) {
    A.digitalWrite(f, HIGH);
    delay(d );
  }
  for (int f = 1; f <= 16; f++) {
    B.digitalWrite(f, HIGH);
    delay(d );
  }
  ////////////  OFF THE LIGHT ONE BY ONE  FROM BEGINNIG
  for (int f = 1; f <= 16; f++) {
    A.digitalWrite(f, LOW);
    delay(d);
  }
  for (int f = 1; f <= 16; f++) {
    B.digitalWrite(f, LOW);
    delay(d);
  }
}




user41951: Assuming that the adressing is correct and all the modules work fine individually, there are some things you can do:

try to disable the slave select of the modules that aren’t require to communicate at a certain time, there are examples for that
add a bit of code where you define chip select as an input for all but one and see if you can communicate with that one. Do that for all of them
remove MISO pin from all but one and see if you can communicate with that one. Do that for all of them
use a tri-state buffer through which you connect the MISO pin and use chip select for enabling the buffer. This buffer puts the MISO pin into a state of high impedance when a certain module is not used for communication and prevents fata from being lost


user35014:  MCP A(0, 9);                              
 MCP B(1, 8);
 MCP C(2, 7);                              
 MCP D(3, 6);
 MCP E(4, 5);                              
 MCP F(5, 3);


CS on pin 10 is often used for Ethernet
CS on pin 4 is often used for SD


33150: <p>I would like to use 7 MCP23S17 as output expanders on one SPI bus. Every IC has its own address from 0 to 6. The first MCP23S17 can be written with no problem. The second chip did not work properly. The CS pin of the MCP23S17 is set like at the all other 4 ICs.</p>

<p>Does anybody have experience with more then 4 MCP23S17 on SPI? Could anyone help?</p>

<pre><code>#include &lt;SPI.h&gt;
#include &lt;MCP23S17.h&gt;

MCP A(0, 10);
MCP B(1, 8);
int d = 250;

void setup() {
  A.begin();
  B.begin();
  for (int k = 1; k &lt;= 16; k++) {
    A.pinMode(k, OUTPUT);
    B.pinMode(k, OUTPUT);
  }
}

void loop() {
  //////////// ON THE LIGHT ONE BY ONE  FROM BEGGING
  for (int f = 1; f &lt;= 16; f++) {
    A.digitalWrite(f, HIGH);
    delay(d );
  }
  for (int f = 1; f &lt;= 16; f++) {
    B.digitalWrite(f, HIGH);
    delay(d );
  }
  ////////////  OFF THE LIGHT ONE BY ONE  FROM BEGINNIG
  for (int f = 1; f &lt;= 16; f++) {
    A.digitalWrite(f, LOW);
    delay(d);
  }
  for (int f = 1; f &lt;= 16; f++) {
    B.digitalWrite(f, LOW);
    delay(d);
  }
}
</code></pre>

<p><a href="https://i.stack.imgur.com/YVkd2.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YVkd2.png" alt="enter image description here"></a></p>

<p><a href="https://i.stack.imgur.com/jXDop.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/jXDop.jpg" alt="enter image description here"></a></p>
 41951: <p>Assuming that the adressing is correct and all the modules work fine individually, there are some things you can do:</p>

<ul>
<li><p>try to disable the slave select of the modules that aren’t require to communicate at a certain time, there are examples for that</p></li>
<li><p>add a bit of code where you define chip select as an input for all but one and see if you can communicate with that one. Do that for all of them</p></li>
<li><p>remove MISO pin from all but one and see if you can communicate with that one. Do that for all of them</p></li>
<li><p>use a tri-state buffer through which you connect the MISO pin and use chip select for enabling the buffer. This buffer puts the MISO pin into a state of high impedance when a certain module is not used for communication and prevents fata from being lost</p></li>
</ul>
 35014: <pre><code> MCP A(0, 9);                              
 MCP B(1, 8);
 MCP C(2, 7);                              
 MCP D(3, 6);
 MCP E(4, 5);                              
 MCP F(5, 3);
</code></pre>

<ul>
<li><code>CS</code> on pin 10 is often used for Ethernet</li>
<li><code>CS</code> on pin 4 is often used for SD</li>
</ul>
