-->
Page 1 of 4

What GPIO pins that can be as a SPI CS pin on an ESP8266 12E

PostPosted: Wed Nov 27, 2019 2:58 pm
by SomeGuy
I want to connect a OLED panel & 4 SPI devices to a NodeMCU ESP8266 board. The OLED panel is connected to the SDA(GPIO 4) and SCL(GPIO 5) pins. The data line(GPIO 12) and clock line(GPIO 14) are common. I see the possible choices for chip select pins to be the other free GPIO pins.

1) GPIO 15

2) GPIO 16

3) GPIO 0

4) GPIO 2

5) GPIO 13

6) GPIO 3

7) GPIO 1

Now with these options laid out, how do we choose which of these pins can be used as a chip select. The SPI device I am using is the MAX31855 thermocouple amplifier.

Re: What GPIO pins that can be as a SPI CS pin on an ESP8266

PostPosted: Fri Dec 13, 2019 4:18 am
by eriksl
That depends on which SPI controller you're going to use or even bit-banging (in which case you can use any pin you like). AFAIK both SPI controllers support about 4 distinct CS GPIO's to choose from.

Re: What GPIO pins that can be as a SPI CS pin on an ESP8266

PostPosted: Sat Dec 14, 2019 4:54 am
by schufti
??? spi-controller does not know about CS at all, spi library has to be told which gpio to use.
One can use SPI totally w/o CS if there is only a single device on the bus.
Every free (not otherwise used) gpio can be used as CS.
https://arduino-esp8266.readthedocs.io/ ... s.html#spi

Re: What GPIO pins that can be as a SPI CS pin on an ESP8266

PostPosted: Fri Dec 20, 2019 8:11 am
by eriksl
False. Depending on what SPI controller you're using ("SPI" or "HSPI") you can have the controller control the CS line (or not, it's optional). The HSPI controller (which we are most likely to use, because it doesn't interfere with flash access) only offers one CS line (fixed). The SPI controller offers three. If one of these doesn't suit your needs, you can always choose to not use the controller-controlled CS lines and control them yourself.