Hello everyone.
I currently trying to get the MCP23S17 port extender running
and I found a example library here
https://playground.arduino.cc/Main/MCP23S17
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() {
Serial.begin(9600);
outputchip.begin();
for (int i = 1; i <= 16; i++) {
outputchip.pinMode(i, OUTPUT);
}
}
uint8_t onoff = 0;
uint8_t outPin = 8;
void loop() {
byte x = Serial.read();
if(x=='l') {
onoff = !onoff;
Serial.print("state "); Serial.println(onoff);
outputchip.digitalWrite(outpin, onoff);
}
delay(10);
}
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.

