sniffer

With aphoticjezter’s confirmation that the undocumented I2C sniffer actually works, we tweaked the code to help get around the UART speed limitations. These updates are in the latest nightly build.

The I2C and SPI sniffers now use a 4096byte output ring buffer. Sniffer output goes into the ring buffer and gets pushed to the PC when the UART is free. This should eliminate problems with dropped bytes, regardless of UART speed or display mode. A long enough stream of data will eventually overtake the buffer, after which new bytes will be dropped until space is available.

Sniffer demos and documentation after the break.

I2C sniffer

The I2C sniffer is implemented in software and seems to work up to 70kHz. It’s still very beta, improvements are probably possible.

  • [/]  – Start/stop bit
  • +/-  – ACK/NACK

I2C start and stop bits are represented by the normal Bus Pirate syntax.

I2C>(2)
I2C bus sniffer, press any key to exit
[0x40-][0x40-0x40-0x30-0x56-0x77-]
I2C>

Sniffed data values are always HEX formatted in user mode. Press any key to exit the sniffer.

See here for more about the I2C sniffer in I2C binary mode.

SPI 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 ().

See here for more about the SPI sniffer in SPI binary mode.

Notes

Both sniffers use the user input buffer as a ring buffer. Any commands entered after the sniffer macro will be lost.

If the ring buffer is full, bytes are simply dropped until there’s free space. The MODE LED turns off if this happens.

As noted in the comments, pins that are normally output become inputs in sniffer node. MOSI and CLOCK are inputs in I2C sniffer mode. MOSI, CLOCK, MISO, and CS are all inputs in SPI sniffer mode.

Advertisements