SPI/Four wires and a light/Four wires
Lesson 2 of 14 · in 3D and VR

Four wires

SPI is four wires and no more. Two carry data, one carries the clock, one picks which chip is listening. Most first-day failures with a new SPI part are one of those four on the wrong pin.

Lonely BinaryUpdated 2026-09-304 min readNo board required

View it in VR

Lesson 2 of the SPI course opens in a VR headset, on a table in front of you, and a voice starts three seconds after you arrive. Type this short address into the browser on a headset such as Meta Quest or Apple Vision Pro, and press Enter VR. No headset? Press Start the lesson: the same lesson, full screen.

learn.lonelybinary.com/vr/spi/2

The four wires

Between a controller and a peripheral, SPI has four wires, and each has one job. SCK is the clock. The controller drives it, and every other wire is read on its edges. MOSI carries data from the controller to the peripheral, and MISO carries data from the peripheral back. CS, chip select, says which peripheral is being spoken to. It is active low: a peripheral is selected while its CS is held at ground.

SCK, MOSI and MISO are shared by every peripheral. Each has a CS of its own.

Straight, not crossed

The names say whose output the wire is. MOSI is the controller's output, so it leaves the controller's MOSI pin and arrives at the peripheral's MOSI pin. MISO does the same in the other direction. A serial link crosses its wires, TX to RX. On SPI, the name at one end is the name at the other.

Some newer datasheets print other names for the same wires, such as SDI and SDO, or PICO and POCI. Read what the datasheet says the pin does. This course keeps MOSI and MISO, which the ESP-IDF documentation prints.

Three wires

Four wires is the standard. A peripheral that only listens, such as a small display, has nothing to send back and may have no MISO pin, which leaves SCK, MOSI and CS. Motorola's S12 SPI block guide notes that some peripherals are receive only. Such a part cannot be read, and a driver that tries gets a meaningless value.

Some chips also have a three-wire mode, where MOSI and MISO share one bidirectional line. The BME280 datasheet has one. These are different things, so a bare "3-wire" in a listing means nothing until the datasheet says which.

What it costs

There is no address on these wires. The peripheral that listens is the one whose CS is low, so a shared CS or a floating CS is reported by nothing. The bus is silent, or the wrong chip answers.

Common mistakes

  • Crossing MOSI and MISO like TX and RX. The names match at both ends.
  • Reading from a part that has no MISO. The value is meaningless, and it looks like a bug in the driver.
  • Taking "3-wire" to mean one thing. It can mean no MISO, or a shared data line. Check the datasheet.

Edit this page — content/fundamentals/spi/four-wires.mdx

Discuss this article

Ask about this page. The answer stays here, on the page it belongs to, for whoever hits the same wall next.

Browse Fundamentals on the forum →