Hello everyone.

I currently trying to get the MCP23S17 port extender running

and I found a example library here

To test the chip I wanted to drive a LED and therefore configured the example code to

#include <Arduino.h>

#include <SPI.h>
#include "MCP23S17.h"

const uint8_t chipSelect = 10;

MCP outputchip(0, chipSelect);

void setup() {

  for (int i = 1; i <= 16; i++) {
    outputchip.pinMode(i, OUTPUT);


uint8_t onoff = 0;
uint8_t outPin = 8;

void loop() {

  byte x =;

  if(x=='l') {
    onoff = !onoff;
    Serial.print("state "); Serial.println(onoff);
    outputchip.digitalWrite(outpin, onoff);



the wiring is shown in the attachment.

When I hit the ledkey (l) to trigger the 8 pin nothing happened. I measured the clock, miso, mosi and the CS when I hit the triggerkey and there is communication there. I did not decipher the the transferred byte yet.

Then I measured the outputpin directly and found something weird. The Signal (against GND) looked like some kind of waveform. (attachment: signal_pin8.bmp). When I hit the trigger nothing changes in the signal, or it is too small to notice.

In my understanding the pins should just work like the digital pins of the arduino. When I set them to OUTPUT I switch them between HIGH and LOW and should therefore just see a constant line. This looks more like some noise on the GND. I tried it with other pins of course and even a different chip.

My next step would be to build the library myself and initiate communication using simply SPI.h. But with the strange signal on the pins it may be a hardware/ wiring error.

Maybe some of you have experience with this chip and can help me with this very detailed question.

Thanks in advance.

In the fritzing breadboard the connections between the lower and upper power rails are missing. if the real world breadboard is missing that too RESET might be activated constantly.

In most situations we prefer the schematic view over the breadboard view of fritzing.

The power and GND is connected properly (I just missed the connections in Fritzing).

I will try to update my PCB and post a schematic

Did you try the single parameter variants of the pinMode() and digitalWrite() methods to set all pins to the same state?

Are you using a Nano as pictured in the fritzing breadboard view?

Not yet.

Good suggestions. I will also measure the MISO and CLK lines to check if the correct data is sent.