I'm working in a project where I need maybe 15 GPIOs, in this project I have to use:
ENC28j60 (Ethernet SPI) (D5, D6, D7, D8)
MFRC522 (NFC reader) (D5, D6, D7, D4)
Oled display (I2C) (D1, D2)
some GPIO (D0, D3)
That is working Ok know but I need more GPIO then I think that I have two options if I wanna use the same microcontroller:
I know that the ESP8266 has a SPI port (Image attached) so I'm not sure if I can use this port to connect my ENC28j60 and MFRC522 in order to use the D5, D6, D7 as a normal GPIO.
Use this SPI port as a normal GPIO.
What can I do to have more GPIO with the same microcontroller??
esp8266 has two SPI interfaces. one is used for the external flash memory, second is on pins labeled D5, D6, D7 on NodeMcu.
the flash memory access is controlled be SDK so you can't use it. the SDK has a way to share this SPI interface but accessing the flash always has the priority
OnJuanTrack:
Thanks friend, then is possible connect my ENC28j60 and my MFRC522 to this port to use D5, D6, D7 as a normal GPIO? maybe do you have any tutorial?
it is not. your devices would be interrupted in the middle of the SPI communication. the option to share the SPI with the flash memory is indicated in the technical documentation of the esp866 but as far as I know no-one attempted it
EDIT: this is of course a wrong answer. I assume, I mixed up threads then, thinking about io 5, 6, 7
d5/6/7 is the normal SPI port, not the one used for external flash access (that's like, 9/10/11/12/13 iirc on some boards - depending on the exact model of chip used for the flash and the hardware configuration, one of these pins may or may not be used, because it's only used if the flash is accessed in QIO mode, which doubles transfer speed - and, since each instruction is fetched from the flash at runtime, execution speed gets a large bump as well - at a cost of one pin. Or maybe it was 2 extra pins for QIO? Something like that.)
Those pins can be used as normal GPIO - of course not at the same time that they're being used as flash, since whatever sort of GPIO-functionality you're using will probably be upset by the pins being periodically put back into SPI mode and transmitting a bunch of data.
If you need more pins on a low cost device with integrated wifi, take a look at the esp32.