Bus Pirate

From YobiWiki
Jump to navigation Jump to search

Description

I'm talking about this beast

Installation

My udev rules

I added a /dev/bus_pirate symlink by following this post:

$ ATTRS=$(sudo udevadm info -a -p \
          $(sudo udevadm info -q path -n /dev/$(dmesg|\
              grep "FTDI.*attached"|\
              tail -n 1|\
              grep -o "ttyUSB[0-9]\+"))|\
          egrep "ATTRS{(serial|idVendor|idProduct)}"|\
          head -n 3)
$ echo "SUBSYSTEM==\"tty\"" $ATTRS "SYMLINK+=\"bus_pirate\""|\
  sudo tee /etc/udev/rules.d/91-usb-buspirate.rules

If you've problems with modem-manager trying to access the device (as seen in /var/log/syslog), you can add the following rule:

ATTRS{idVendor}=="0403" ATTRS{idProduct}=="6001" ENV{ID_MM_DEVICE_IGNORE}="1"

Usage

CLI

screen /dev/bus_pirate 115200
i
Bus Pirate v3
Firmware v4.2 Bootloader v4.2
DEVID:0x0447 REVID:0x3043 (B5)
http://dangerousprototypes.com
HiZ>
ctrl-A \ (y) to quit

Pinouts

See also http://dangerousprototypes.com/category/pin-reference/
WARNING in the nice sticker colorscheme, the cable is put upside-down (it's said in the comment but I missed it completely the first time)
So if you put your cable going "outwards of the PCB", as seen in the introduction picture, pinout is the following:

GDN      - brown, black EZhook
    +3.3 - red
+5       - pink,  red EZhook
    ADC  - yellow
Vpu      - green
    AUX  - blue
CLK      - violet
    MOSI - grey
CS       - white
    MISO - black

We can perform a self-test with the cable by connecting together red+yellow and pink+green, then simply run "~" on the CLI.

Logic analyzer

See http://dangerousprototypes.com/docs/Logic_analyzer_mode

Installing SUMP is not that easy...
I chose to try a fork of it mentioned in the comments of Sump PC client page

wget http://dl.dropbox.com/u/1026013/Java/Logic%20Analyzer/Logic%20Analyzer.zip
unzip Logic%20Analyzer.zip
sudo aptitude install libftdi-dev librxtx-java

I modified the runme as following for my Debian, and to be able to use a symlink to the runme:

if [ -h $0 ]; then
    DIR=$(dirname "$(readlink $0)")
    cd "$DIR"
fi
java -Xmx256m -cp /usr/share/java/RXTXcomm.jar:analyzer.jar \
     -Dgnu.io.rxtx.SerialPorts="/dev/bus_pirate" \
     -Djava.library.path="/usr/lib/jni" \
     org.sump.analyzer.Loader

Now trying it:
We've only to change the recording size to 4k or lower, other params should be ok
Pins & channels:

chan0 - CS   - white
chan1 - MISO - black
chan2 - CLK  - violet
chan3 - MOSI - grey
chan4 - AUX  - blue
        GND  - brown