Bus Pirate SPI guide

Bus: SPI (serial peripheral interface).
Connections: four pins (MOSI/MISO/CLOCK/CS) and ground.
Output type: 3.3volt normal, or open collector (pull-up resistors required).
Pull-up resistors: required for open drain output mode (2K – 10K).
Maximum voltage: 5.5volts (5volt safe).

Syntax Description
A/a/@ Toggle auxiliary pin. Capital “A” sets AUX high, small “a” sets to ground. @ sets aux to input (high impedance mode) and reads the pin value.
D/d Measure voltage on the ADC pin (v1+ hardware only).
W/w Capital ‘W’ enables the on-board power supplies. Small ‘w’ disables them. (v1+ hardware only).
[ Chip select (CS) active (low).
{ CS active (low), show the SPI read byte after every write.
] or } CS disable (high).
R or r Read one byte by sending dummy byte (0xff). (r:1…255 for bulk reads)
0b Write this binary value. Format is 0b00000000 for a byte, but partial bytes are also fine: 0b1001.
0h/0x Write this HEX value. Format is 0h01 or 0×01. Partial bytes are fine: 0xA. A-F can be lower-case or capital letters.
0-255 Write this decimal value. Any number not preceded by 0x, 0h, or 0b is interpreted as a decimal value.
, Value delimiter. Use a coma or space to separate numbers. Any combination is fine, no delimiter is required between non-number values: {0xa6,0, 0 16 5 0b111 0haF}.
& Delay 1uS. (&:1…255 for multiple delays)
(#) Run macro, (0) for macro list
Macro Description
0 Macro menu
1 SPI bus sniffer with configurable CS filter.

Configuration options

Speed - 30kHz, 125kHz, 250kHz, 1MHz.

Clock polarity - idle low, idle high.

Output clock edge - idle to active, active to idle.

Input sample phase – middle, end.

Output type - open drain/open collector (high=Hi-Z, low=ground) , normal (high=3.3volts, low=ground). Use open drain/open collector output types with pull-up resistors for multi-voltage interfacing.

SPI Bus sniffer

The SPI sniffer is implemented in hardware and should work up to 10MHz. It follows the configuration settings you entered for SPI mode.

  • [/]  – CS enable/disable
  • 0xXX – MOSI read
  • (0xXX)  – MISO read

SPI CS pin transitions are represented by the normal Bus Pirate syntax. The byte sniffed on the MISO pin is displayed inside ().

SPI>(1)
Sniff when:
1. CS low
2. CS high
3. All traffic
(1) >
SPI bus sniffer, any key exists
[0x30(0x00)0xff(0x12)0xff(0x50)][0x40(0x00)]

The SPI sniffer can read all traffic, or filter by the state of the CS pin. The byte sniffed on the MOSI pin is displayed as a HEX formatted value, the byte sniffed on the MISO pin is inside the ().

  1. I’m using the bus-pirate (v2go with v3.1FW) to sniff a SPI port, I sometimes get an output in the terminal which isn’t correctly HEX formatted, for example: 0×0x01F.
    Any ideas of what is causing this?

    Reply

  2. Oh nevermind.. I’m sniffing continuous 8Mhz SPI data, so the little BusPirate isn’t happy as it is over running the buffer. I really should be using a logic analyser instead.

    Reply

  3. I think there is a bug in CS sniffing. It’s set like an output and goes low after entering sniffing mode, then goes up after exiting sniffing mode.
    Anyone got the same behaviour?

    Reply

    1. I’ll check it out before the next release. Thanks for the bug report.

      Reply