Skip to content

A very basic bus sniffer and communicator (UART, SPI, I2C)

License

Notifications You must be signed in to change notification settings

andrenho/poor-man-bus-pirate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

83 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Poor man's Bus Pirate

A very basic bus sniffer and communicator (UART, SPI, I2C, etc). A simplified (and cheaper) version of the Bus Pirate.

Features

This circuit can be used to either sniff communication between components (such as microcontrollers), or to directly communicate with the components using the computer.

  • Supported input/output formats: ASCII, hexadecimal, decimal and binary
  • Supported protocols:
    • UART (with or without hardware flow control)
      • Baud autodetect
    • SPI (master, slave, sniffing)
    • I2C (not implemented yet)
    • PWM output
  • Supported I/O voltages: 3.3V and 5V

Commands

Connect the Pico USB to the computer, and then open a serial terminal to the USB port at 115200 baud.

  • General
    • use [ uart | spi_master | spi_slave | spi_sniff | pwm ]
    • reset (reset all options to default)
    • set (print all variables)
  • UART
    • set uart.baud [NNN] (default: 115200)
    • set uart.mode [MMM] (default: 8N1)
    • set uart.hflow [on | off] (default: off)
    • set uart.output [ascii | dec | bin | hex] (default: ascii)
    • use uart guess: tries to autodetect baudrate
  • SPI
    • set spi.cpol [0 | 1] (default: 0)
    • set spi.cpha [0 | 1] (default: 0)
    • set spi.order [lsb | msb] (default: msb)
    • set spi.baud [NNNN] (baud rate in Hz, master only, default: 100000)
    • set spi.autorespond [off | NN] (always respond with byte NN, default off)
    • set spi.output [ascii | dec | bin | hex] (default: hex)
  • I2C
    • set i2c.baud [NNNN] (baud rate in Hz, master only, default: 100000)
    • set i2c.output [ascii | dec | bin | hex] (default: hex)
    • use i2c scan: scan for connected slave addresses
  • PWM
    • set pwm.freq [NNNN] (frequency in Hz, default: 100000)
    • set pwm.duty [NN] (% duty cycle, default: 50)

Press CTRL+C to end communication with a protocol at any time.

Settings are saved on flash, and persist after a reboot.

Communication example:

image

Pinout

BP pin UART SPI master SPI slave SPI sniff I2C function PWM function RPi Pico pin
COMM0 TX MISO MOSI RX0 SDA PWM0 GP0 (1)
COMM1 RX0 CS SS SS SCL GP1 (2)
COMM2 CTS SCK SCK SCK GP2 (4), GP10 (14)
COMM3 RTS MOSI MISO GP3 (5)
COMM4 RX1 RX1 GP5 (7), GP8 (11)
GND GND

Circuit

This section is mandatory - it provides the computer interface, and allows communicating with components at 3.3V.

image

This section is optional, and allows for communicating with 5V devices as well.

image

This section is optional, and adds blinking lights to communication channels to indicate activity.

image

Firmware update

To update the firmware:

  1. Download the file poor-man-bus-pirate.zip and uncompress it.
  2. Connect the Raspberry Pi Pico via USB to the computer while pressing the BOOTSEL button.
  3. This will create a USB mount. Copy the file poor-man-bus-pirate.uf2 into that directory.
  4. Restart the Pico.

Implementation

This is the circuit I implemented for my personal use:

image