Use this forum to chat about hardware specific topics for the ESP8266 (peripherals, memory, clocks, JTAG, programming)

User avatar
By martinayotte
#15409 Just to let people knows, the small brother of MCP23S17, MCP23017 (with '0' instead if 'S') is I2C compatible and was working with ESP8266 since months, so we have plenty of GPIOs since awhile. The only drawback was the speed of I2C. With the new MetalPhreak driver, we have now much faster GPIOs. :)
User avatar
By metalphreak
#15480 It works!

Well, I did forget an ending bracket } at the end of a function. Fixed that and pushed to Github.

Setup a breadboard with 16 leds on the output. Using the following code to get a binary counting clock.

Code: Select allmcp23s17_init();

mcp23s17_REG_SET(IODIR_CTRL, PORT0, 0x0000);

uint16 portval = 0x0000;

while(1) {

sGPIO_SET(PORT0, portval);

portval++;

os_delay_us(10000); //10ms delay so you can actually see it counting :D

}


Yes, there is an i2c version of this chip (8 and 16 pin GPIO versions). It would be a good alternative option if we had a hardware i2c controller on the ESP8266.

The downside to software (aka 'bit banging') i2c or SPI, is you have this 80MHz microprocessor core sitting there doing nothing while you have os_delay_us(10000) or something between you banging out the highs and lows of the i2c or SPI commands.

With this, you can write out the entire 16 GPIO pins in a matter of microseconds, letting the hardware SPI module in the ESP8266 do all the work, while the processor goes back to handling your other requirements (servicing Wifi/IP etc).