{
  "id": "wire-format/spi-protocol",
  "family": "wire-format",
  "slug": "spi-protocol",
  "title": "SPI (Serial Peripheral Interface) protocol",
  "summary": "SPI is a 4-wire synchronous serial bus: SCLK (clock), MOSI (master out slave in), MISO (master in slave out), CS (chip select). Communication: master asserts CS (low), toggles SCLK, sends data on MOSI, receives data on MISO. No addressing (CS selects the slave). No ACK. Full-duplex (simultaneous send/receive).",
  "kind": "wire-format",
  "aliases": [
    "SPI (Serial Peripheral Interface) protocol"
  ],
  "status": "standard",
  "verification": "verified",
  "tier": "B",
  "source_url": "https://www.rfc-editor.org/",
  "source_version": "retrieved 2026-05-29",
  "retrieved_date": "2026-05-29",
  "ext_type": "wire-format@1",
  "ext": {
    "spec": "SPI specification",
    "summary": "SPI is a 4-wire synchronous serial bus: SCLK (clock), MOSI (master out slave in), MISO (master in slave out), CS (chip select). Communication: master asserts CS (low), toggles SCLK, sends data on MOSI, receives data on MISO. No addressing (CS selects the slave). No ACK. Full-duplex (simultaneous send/receive).",
    "structure": [
      {
        "field": "SCLK",
        "size": "clock",
        "meaning": "Serial clock, generated by the master. Frequency up to tens of MHz."
      },
      {
        "field": "MOSI",
        "size": "data",
        "meaning": "Master Out Slave In: data from master to slave."
      },
      {
        "field": "MISO",
        "size": "data",
        "meaning": "Master In Slave Out: data from slave to master."
      },
      {
        "field": "CS (SS)",
        "size": "control",
        "meaning": "Chip Select (Slave Select): active low. Master asserts CS to select a slave."
      },
      {
        "field": "CPOL",
        "size": "mode",
        "meaning": "Clock Polarity: 0 = clock idle low, 1 = clock idle high."
      },
      {
        "field": "CPHA",
        "size": "mode",
        "meaning": "Clock Phase: 0 = sample on leading edge, 1 = sample on trailing edge."
      },
      {
        "field": "Mode 0",
        "size": "CPOL=0, CPHA=0",
        "meaning": "Clock idle low, sample on rising edge."
      },
      {
        "field": "Mode 1",
        "size": "CPOL=0, CPHA=1",
        "meaning": "Clock idle low, sample on falling edge."
      },
      {
        "field": "Mode 2",
        "size": "CPOL=1, CPHA=0",
        "meaning": "Clock idle high, sample on falling edge."
      },
      {
        "field": "Mode 3",
        "size": "CPOL=1, CPHA=1",
        "meaning": "Clock idle high, sample on rising edge."
      },
      {
        "field": "MSB/LSB first",
        "size": "config",
        "meaning": "Most SPI devices use MSB-first. Some use LSB-first."
      }
    ],
    "example_hex": "00 00",
    "example_decoded": "SPI: two zero bytes (no standard wire format; shown as placeholder)",
    "notes": [
      "SPI is full-duplex: master and slave exchange data simultaneously.",
      "SPI has no addressing, no ACK, and no flow control (beyond CS).",
      "SPI is faster than I2C (tens of MHz vs 400 kHz).",
      "SPI is used for SD cards, flash memory, displays, sensors, and many peripherals.",
      "Quad SPI (QSPI) uses 4 data lines for 4x throughput."
    ]
  },
  "updated": "2026-05-29"
}
