Closed thijstriemstra closed 2 years ago
@thijstriemstra , sorry for the inconvenience! I found and fixed the issue. The default SPI object ( _spi{&SPI} ) was missing in one of the constructors for SPI. Despite this bug, it strangely worked on an Arduino Nano and therefore I had not found it when I tested version 1.6.1. Interesting learning - it did not even produce a compiler warning on the Arduino.
1.6.1: MCP23017(uint8_t cs, uint8_t rp, uint8_t addr) : SPI_Address{addr}, resetPin{rp}, csPin{cs}, useSPI{true} {} 1.6.2: MCP23017(uint8_t cs, uint8_t rp, uint8_t addr) : _spi{&SPI}, SPI_Address{addr}, resetPin{rp}, csPin{cs}, useSPI{true} {}
This library is quite challenging to test when changes are applied. There so many different combinations of MCUs, MCP23x1y types, example sketches and options for passing SPI / TwoWire objects, using TinyWireM and using the reset pin or not.
I have tested the new version 1.6.2 on an ESP32, Arduino Nano, including the option to use several MCP23S17 with different addresses.
Thanks for raising the issue.
I have tested the new version 1.6.2
Once it's available in the platformio registry I'll give it a try (it's still on 1.6.1 for some reason). Did you update the version nr?
This library is quite challenging to test when changes are applied. There so many different combinations of MCUs, MCP23x1y types, example sketches and options for passing SPI / TwoWire objects, using TinyWireM and using the reset pin or not.
You can use the github actions with platformio setup for this: it allows you to test a configuration (e.g. an .ino file for mcp23s17 with spi) against one or more boards. Without such a setup you'll keep running into bugs like this IMO.
Once it's available in the platformio registry
Tested 1.6.2 and works fine.
my mcp23s17 + mcp23017 esp32 application seems to crash on v1.6.1, 1.6.0 seems to work fine.
Crash dump (if it helps at all):