Skip to main content

SPI Protocol Commands

Overview

  • Bus: SPI (serial peripheral interface)
  • Connections: four pins (CDO/CDI/CLK/CS) and ground
  • Output type: 1.65-5volts
  • Maximum voltage: 5volts

SPI is a common 4 wire full duplex protocol. Separate connections for data-in and data-out allow communication to and from the controller at the same time. Multiple sub devices can share the bus, but each will need an individual Chip Select (CS) connection. Chip Select is generally active when low.

Configuration options

Bus Pirate [/dev/ttyS0]
SPI speed
1 to 62500KHz
x. Exit
KHz (100KHz*) >
Data bits
4 to 8 bits
x. Exit
Bits (8*) >
Clock polarity
1. Idle LOW*
2. Idle HIGH
x. Exit
Polarity (1) >
Clock phase
1. LEADING edge*
2. TRAILING edge
x. Exit
Phase (1) >
Chip select
1. Active HIGH (CS)
2. Active LOW (/CS)*
x. Exit
CS (2) >
Actual speed: 122KHz
Mode: SPI
SPI>

Syntax

CommandDescription
[Chip select (CS) active (low)
{CS active (low), show the SPI read byte after every write
] or }CS disable (high)
rRead one byte by sending dummy byte (0xff). (r:1…255 for bulk reads)
0bWrite this binary value. Format is 0b00000000 for a byte, but partial bytes are also fine: 0b1001.
0xWrite this HEX value. Format is 0x01. Partial bytes are fine: 0xA. A-F can be lower-case or capital letters.
0-255Write this decimal value. Any number not preceded by 0x or 0b is interpreted as a decimal value.
spaceValue delimiter. Use a space to separate numbers. No delimiter is required between non-number values: {0xa6 0 0 16 5 0b111 0xaF rrrr}.
(#)Run macro, (0) for macro list.

Macro

NumberDescription
0Macro menu

Connections

Bus PirateDirectionCircuitDescription
CDOCDOController Data Out
CDICDIController Data In
CSCSChip Select
CLKCLKClock signal
GNDGNDSignal Ground