I normally use the Linux utility screen to connect to my BusPirate. I have two tips
While connecting to the BP, if you want to scroll back the terminal history (i.e. to see the help menu), press "Control-A ESCAPE - and then you can use the up-arrow and down-arrow to scroll the display.
Here is a trivial script I use with screen. It reminds me if the BusPirate is unplugged or in bootloader mode.
#!/bin/sh
# Launch BusPirate using screen
#Usage:
# BusPirate
# BusPirate /dev/ttyACM2 - if it's on a different port
TT=${1:-"/dev/ttyACM0"} # default port
# You have to change this to match your ID
ID=5021-0000
#Is it in bookloader mode?
if [ -d /media/$USER/RPI-RP2 ]
then
echo "Unplug and replug the BusPirate"
elif [ -d /media/$USER/$ID/ ]
then
# Looks good
screen "$TT" 115200
else
# What? No Bus Pirate?!?!
echo "Please plug in your Bus Pirate"
fi
Iād like to make a script that watches the bus pirate firmware file for changes (python watchman?), then sends bootloader code to Bus Pirate binary interface. Watch for the USB drive to attach, copy the firmware.
I think it will be faster than the debugger when I donāt need to step code.
While screen is an excellent tool, Iād highly recommend checking out tio, which is a serial terminal emulator specifically designed for hardware hacking/development:
It has a lot of nice features, such as defaulting to 115200 8n1 and gracefully reconnecting when a serial device goes down and comes back up (like when updating the firmware on the BP5). It also offers a remapping function which can fix some of the unusual behaviors the BP exhibits under different platforms (such as backspace not working).
In the config file, you can even setup profiles for different devices. Mine looks like this:
# Config file for tio serial terminal emulator
[bp5]
device = /dev/ttyACM0
map = INLCRNL,ODELBS
[bp3]
device = /dev/ttyUSB0
map = INLCRNL,ODELBS
This lets me connect to either the v5 or v3 Bus Pirate by simply running:
Hmm. I Installed tio and used your config file. When I connect to the BP I get no response to anything I type. Is that your entire config file?
[edit] tio /dev/ttyACM0
works fineā¦
Aha. The standard tio installed via apt was an old rev. I had to uninstall tio, install meson, and install tio from the github source, and make sure /usr/local/bin was in my searchpath.
BTW, the toolbar display is much nicer looking than screen. I might just be a convert!
I should have been suspicious when I typed āman tioā and there was no mention of the config file.
Also I would suggest some udev rules that make /dev/buspirate3 and /dev/buspirate5 for example. In case you have more ttys in your system. Mentioned here:
tio also allows you to use the device ID, i.e. /dev/serial/by-id/usb-Bus_Pirate_Bus_Pirate_5_123456789012-if00
I thought that I could use this to automatically distinguish between my rev8 and rev10, but they have the same ID. They have the same serial # as well. I wonder if Ian is going to assign unique serial numbers to them in the future. [edited]
tio can also remap the DEL/BACKSPACE/CONTROL-H keys. I think screen can do this, but i didnāt see an obvious way to do it. The man page for tio is 480 lines, which for screen itās 3278 lines long.
I was looking through the main documentation for more information on BusPirate attached to a pi running Debian. I am using a pi and the GPIO header while developing code for SPI devices and BusPirate in SPI sniff mode is the goto for watching the more complex exchanges. I have normally attached the BP5 to a Mac but I wanted to run the whole thing off the Pi as the code is developed in CLion remotely to the pi and it all seemed a bit crazy to need so many computers in the Dev environment.