SPI on the Arduino UNO (ATmega328P) uses four dedicated hardware pins. Unlike software (bit-banged) SPI, the hardware peripheral is tied to specific port pins and cannot be remapped — correct physical wiring is a prerequisite before any sketch will produce valid transfers. Get the pinout right once and every SPI library on the Arduino ecosystem will work without modification.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/manish04-mu/TheEmbeddedInsights/llms.txt
Use this file to discover all available pages before exploring further.
Pin Mapping
| Signal | Arduino UNO Pin | Direction | Notes |
|---|---|---|---|
| SCK | 13 | Output (master) | Serial clock; driven by the master and shared by all slaves on the bus |
| MOSI | 11 | Output (master) | Master Out Slave In — data transmitted from master to slave |
| MISO | 12 | Input (master) | Master In Slave Out — data returned from slave to master |
| CS | 10 | Output (master) | Chip Select; active LOW — one dedicated CS pin required per slave device |
Pin 10 is used as CS in all example sketches in this series. Technically any digital output pin can serve as CS, but Pin 10 is also the hardware SS pin on the ATmega328P. If Pin 10 is configured as an input while SPI is active, the hardware can automatically switch the device into slave mode — always set it as
OUTPUT even if you choose a different CS pin.Configuring CS in Code
The setup sequence below is taken directly from the Arduino UNO sketches in this series. Three things happen insetup() before any SPI transfer takes place: CS is declared as an output, it is driven HIGH to keep the slave deselected during initialisation, and then SPI.begin() is called to configure the hardware peripheral.
Multiple Slaves
SCK, MOSI, and MISO are shared across every slave on the SPI bus — all three lines connect to every device in parallel. Only CS is unique per slave: each slave device gets its own dedicated CS line connected to a separate Arduino output pin. When the master asserts one slave’s CS LOW, all other slaves see their CS line remain HIGH and ignore traffic on MOSI and SCK. Critically, unselected slaves must tri-state (high-impedance) their MISO output so they do not drive the shared MISO line and corrupt the response from the selected slave. Most SPI peripherals do this automatically when CS is HIGH, but always confirm in the datasheet.Logic Analyzer Probe Points
When verifying SPI signals with a logic analyzer, connect probes to the following pins. The channel assignment below matches the decoding configuration used in all captured waveforms in this series.| Channel | Signal | Arduino UNO Pin |
|---|---|---|
| CH0 | SCK | 13 |
| CH1 | CS / Enable | 10 |
| CH2 | MOSI | 11 |
| CH3 | MISO | 12 |