Skip to content

Bus Pirate Self Test guide

fruss edited this page Mar 13, 2013 · 1 revision

This page shows how to setup the Bus Pirate for both supported self-test procedures using pyBusPirate2. The simplest is the short self-test which doesn't require any pin interconnection and performs a minimal test on the device. The other possible test is the long self-test but it requires to interconnect a couple of pins but the test performed is more complex. What does the self-test do? The self-test verifies that components connected to the PIC24FJ64GA002 respond as expected.

The self-test enables the auxiliary (AUX) pin, MODE LED, and voltage regulator control (VREG), and verifies that each pin went high. The CD4066 control pin (PULLUP) is held at 5volts with a pull-up resistor, so we test it high to see if the pull-up is working, and then low to see if the PIC pin is operating correctly.

If pull-up high fails, check R19. Other errors could be a soldering defect or broken microcontroller. The four analog voltage monitors and the two power supplies are tested. The 3.3volt and 5volt supplies are enabled and checked for the correct voltage. The ADC and Vpullup pin monitors are connected to the power supplies in order to test their function, as well as verify the results of the power supply monitors.

If 5volt and Vpullup (or 3.3volts and ADC) both read 0volts, there could be a problem with the voltage regulator. Check VR3, VR4, C22, C24, R18. If one shows a voltage, but the other doesn't, there could be a problem with the voltage monitor, the PIC microcontroller, or you forgot to connect the pins for self-test mode. Check R10-R16. The bus I/O pins and pull-up resistors are tested three ways. First, all bus pins are set high and verified without pull-up resistors. The pins then go low and the pull-up resistors are enabled to test open drain pin functionality. Finally, the pins are put in high-impedance mode to test the on-board pull-up resistors.

Open collector high failures could indicate a problem with the on-board pull-up resistors, or you forgot to connect the 5volt and Vpullup pins. Check R19, R20-R23, IC3. Other errors could be a soldering defect or broken microcontroller. If your Bus Pirate fails the self-test…

Make sure that no device is connected to any of the pins Ensure that the +5v pin is connected to the Vpullup pin Check that the +3.3v pin is connected to ADC pin Check for poor solder connections or solder bridges Post the results of your test in the unofficial Bus Pirate forum Short Self-Test Instructions Bellow is the output of a successful execution of the script:

topo@desktop:~/projects/bus_pirate/pybuspirate2$ ./bp_self_test.py /dev/bus_pirate --short
[+] Connecting to the Bus Pirate and initiating BitBang mode...
[+] Successfully connected to the Bus Pirate.
[+] Setting verbosity level...
[+] Performing short self-test...
[+] Bus Pirate self-test was successful.
[+] Restoring Bus Pirate to user terminal...

Sample code

from pyBusPirate2.SelfTest      import SelfTest, SelfTestException

def main():
    """Initialize the Bus Pirate and execute the selected self-test."""

    try:
        print "[+] Connecting to the Bus Pirate and initiating BitBang mode..."

        bp = SelfTest("/dev/bus_pirate", 115200)

        print "[+] Performing short self-test..."

        # Execute the SHORT self-test
        if bp.performShortSelftest():
            print "[+] Bus Pirate self-test was successful."
        else:
            print "[-] Bus Pirate self-test indicated %d errors." % \
                bp.getErrorsOnTest()

    except SelfTestException, err:
        print "[-] Exception: %s" % err

Long Self-Test

Instructions

Alt text

  1. Disconnect any devices from the Bus Pirate I/O header pins. An external device will interfere with the test, and could be damaged by the voltages used (+5volts) on some pins.

  2. Make the self-test connections shown in the figure above. Connect the Vpullup (Vpu) pin to the +5V pin. Connect the ADC pin to the +3.3V pin.

  3. To begin the self test execute the sample script called bp_self_test.py in the terminal with the following parameters (Self-test is available in HiZ mode only):

  4. You will be reminded to make the self-test connections and remove any external devices. Press any key to run the self-test.

Bellow is the output of a successful execution of the script:

topo@host:~/projects/bus_pirate/pybuspirate2$ ./bp_self_test.py /dev/bus_pirate --long
[+] Connecting to the Bus Pirate and initiating BitBang mode...
[+] Successfully connected to the Bus Pirate.
[+] Setting verbosity level...
[!] **************************************************
[!] Please remove any external device.
[!] Please connect the pins appropriately.
[!] **************************************************
[+] Press any key to continue...
[+] Performing long self-test...
[+] Bus Pirate self-test was successful.
[+] Restoring Bus Pirate to user terminal...

Sample code

from pyBusPirate2.SelfTest      import SelfTest, SelfTestException

def main():
    """Initialize the Bus Pirate and execute the selected self-test."""

    try:
        print "[+] Connecting to the Bus Pirate and initiating BitBang mode..."

        bp = SelfTest("/dev/bus_pirate", 115200)

        print "[+] Performing short self-test..."

        # Execute the LONG self-test
        if bp.performLongSelftest():
            print "[+] Bus Pirate self-test was successful."
        else:
            print "[-] Bus Pirate self-test indicated %d errors." % \
                bp.getErrorsOnTest()

    except SelfTestException, err:
        print "[-] Exception: %s" % err