ESP8266 Hardware SPI (HSPI) General Info and Pinout

The ESP8266 has two hardware SPI modules. Espressif have named these SPI and HSPI.

SPI: This SPI module is capable of quad data channels and has 3x chip select pins available. However, it is already in use on 99.9% of modules where the operational code is loaded off a flash rom chip. It is incredibly difficult to use this for other devices at the same time without constant interruption and I don’t recommend it. You can, however, mux the HSPI pins onto the same ones as the SPI module. The SPI module will take over control of the pins when it needs access (so you’re not guaranteed your HSPI operation all the time). I won’t be covering anything more on the SPI module any time soon though. HSPI is where it’s at for simplicity.

HSPI: Presumably this is meant to stand for HardwareSPI, but you can think of it as the User SPI. The pinout required is below.

Pin Name GPIO # HSPI Function

Pin Name is the one given in the datasheet. Note that the MTCK (which is a clock signal for something else) is NOT the clock for the HSPI! Same with the MTDO (data out) pin. It’s actually the HSPI Chip Select (or Slave Select). Easy to be confused 🙂

Note: GPIO15 needs to be tied to GND when booting from the onboard SPI flash (see below table). Just use a suitable pull down resistor (4.7k or something) so the pin can still properly function as a chip select. Do not connect it directly to GND!

GPIO15 GPIO0 GPIO2 Mode Description
L L H UART Download code from UART
L H H Flash Boot from SPI Flash
H x x SDIO Boot from SD-card

With the HSPI bus wired correctly to your SPI slave device, you can get started using the SDK code. See my other posts for more information on controlling the HSPI hardware.

Posted in General.


  1. Pingback: Some christmas leds – Beer!

  2. Pingback: Analog to Digital Converter MCP3002 in ESP8266 | macsbug

  3. Hi,
    Just wanted to say thanks for sharing all this information. I was working on a HSPI slave implementation and your information was of great help. I also tried to compile for myself a basic “SPI registers reference documentation” using all sources I could, among which this blog of course, and I finally thought it could be of interest to others so I shared it. Feel free to comment/correct if you like of course.
    Thanks and keep on the good work !
    The topic is
    and the document is attached to this post

  4. Hey there, I think your blog might be having
    browser compatibility issues. When I look at your blog
    site in Chrome, it looks fine but when opening in Internet
    Explorer, it has some overlapping. I just wanted to give you a
    quick heads up! Other then that, superb blog!

  5. Pingback: NodeMCU (ESP8266) with Arduino IDE | Andreas' Blog

Leave a Reply

Your email address will not be published. Required fields are marked *