I started testing a MCP2307-IO-expansion-board. I want to measure what is the practical upper limit of toggling / reading in an IO-expansion-pin.
I2C-Scanner found adress0x27
using the Adafruit_MCP23017.h-library I'm able to toggle an IO-Pin on the expansionboard with a very simple testcode?
I have adjusted the Arduino-IE to Teensy 4.1 board and I'm able to upload code.
The pin is toggling. I measured the SCL-clock-frequency with my DSO and found 98.6 kHz which is aprox. 100 kHz.
Then I tried to increase the I2C-SCL-Clock-frequency with the command
Wire.setClock(400000);
But the SCL-Clock-frequency stays the same.
I have connected the IO-pins 18,19 as SDA/SCL according to this Pinout of the Teensy 4.1
That sounds like it could be I2C High-Speed Mode. The processor on the T4.1 does support it, but it appears to require different configuration of the various control registers. So, you should start by reading the I2C chapter of the processor's datasheet. Then open up the T4.1's implementation of the Wire library and see if it accommodates High-Speed Mode.
Or, if you really want to go fast, just use the SPI interface - 10MHz max on MCP23017.
"Somewhere" is not a very authoritative source. Like I said, grab the datasheet, open the library source code and dig in. Maybe you'll find an implementation error in the code.
EDIT:
You might get more help posting your question on the Teensy Forum if you haven't already.