Page 1 of 1

ESP8266 Thing and SPI: CS NOT hardwired?

Posted: Sun Dec 23, 2018 9:02 pm
by largofluid
I just finished a project that utilizes an ESP8266 Thing (RL-13231 -- aka NOT the Dev version) to drive a Waveshare eInk display with an SPI interface.

There seems to be some confusion w.r.t. what pin can be used for CS when doing SPI communication using the ESP8266 Thing.

The ESP8266 Thing Hookup guide states:
The MISO, MOSI, and SCLK SPI pins are hard-coded and can’t be moved, they are:

Pin Number SPI Function
12 MISO
13 MOSI
14 (SCL) SCLK
15 CS
https://learn.sparkfun.com/tutorials/es ... uino-addon

Note that this only states that MISO, MOSI and SCLK are hard-wired, but CS is not mentioned. Yet the table suggests you have to use pin 15 for CS, which is not available on any breakout header.

Googling around, it seems that a lot of folks run into this issue (being unable to locate pin 15 on this board) when using SPI.

However, I could get things to work by mapping CS to pin 4, which makes me assume that CS is NOT hardwired to pin 15 (as the table seems to imply), but can be assigned to any digital output capable pin.

Just wanted to post this, hoping that this will save other noobs like myself some grief...

Full mapping that I used for the eInk display in conjunction with the GxEPD library:

BUSY --> 12, RST --> 0, DC --> SDA, CS --> 4, CLK --> SCL, DIN --> 13 (MOSI)

I also added "SPI.setFrequency(1000000)" to the setup function of my Arduino sketch, FWIW...