bigfanofiot
Member
I had got one mcp23s17,but it hard for me to drive it using SPI on teensy 4.0,can anyone give me some examples?
thanks very much!
thanks very much!
thanks,I will have a tryAfter you install any of these libraries, click File > Examples and scroll down the long list to look for your freshly installed library's examples.
Some of these libraries give multiple ways to access the hardware. You want "hardware SPI", which is usually the default way.
Beware of "Software SPI", where you can specify all the pins. Often this is written for slower boards and Teensy 4.0 can run much too fast. Often the examples that come with these libraries have multiple ways to access the chip, usually with comments the code to explain. Read those comments and delete any Software SPI config and go with the Hardware SPI config, so you get reliable speed.
Hardware SPI works the same way on virtually all Arduino compatible boards, including Teensy, so any of these libraries with config to use Hardware SPI should work fine on Teensy 4.0.
thanks,I will have a tryIf you search “GitHub mcp23s17 teensy”, you will find some libraries. Here is one.
![]()
GitHub - tonton81/MCP23S17: port expander, teensy, spi
port expander, teensy, spi. Contribute to tonton81/MCP23S17 development by creating an account on GitHub.github.com