I set up my ESP32 with a MCP23017 over i2C (400kHz) and got it working quite well with Adafruit-library. Everything is working as expected.
Then I did some simple measurement to check the HIGH-LOW switch speed and it is really dissapointing.
The code below for simply switching that pin HIGH takes 8,9ms!
Why is that so slow ?
Is this caused by i2C ?
Adafruit lib ?
Is it a better choice to take the MCP23S17 with SPI ?
PS: It doesn't make any difference when I put pull-ups on the SDA/SCL lines...
Thanks!
Code: Select all
uint32 timestamp = micros();
mcp.digitalWrite(pin, HIGH);
Serial.println( micros() - timestamp );