I need to connect to a MCP23S17 16 bit I/O expander from a Boron over SPI. I’m using the MCP23S17_bd78 library to do so. But upon calling the pinMode the Boron crashes, emitting the Red Flash SOS. Justing including the library is fine. And instantiating the library with MCP mcpExpander(0, 14) is also fine. It’s not until the pinMode is called that the crash occurs.
I have the MCP23S17 A0, A1 and A2 pins connected to ground. And Reset connected to 3.3V. VDD is also connected to 3.3v and VSS to ground. SS is connected to A5 (14) of the Boron. MOSI, MISO and SCK are connected to the primary SPI of the Boron. I’ve rechecked the wiring multiple times. I referenced the diagram located here (which is the Arduino library the Particle lib is based on): https://playground.arduino.cc/Main/MCP23S17/
The library is fairly old, last update on github occurred many years ago, so I assume the library isn’t ready for the Boron. As evidence of this look at line 66 of the MCP23S17.cpp file. SPI_CLOCK_DIV2 is used instead of something like SPI_CLOCK_DIV8 (the MCP23S17 requires a clock speed of less than 10MHz).
I changed the SPI_CLOCK_DIV2 to …DIV8 and recompiled. Still, the crash occurs.
At this point, I’m assuming the SPI library is just out of date. I wish I could switch over to the I2C version of the chip but thats not possible. Has anyone used this library with 3rd gen devices with any luck? Any ideas of alternatives, or specific SPI code to talk directly with the MCP23S17?
Thanks in advance