Skip to main content
Topic: BusPirate helper app for your Android device (Read 4603 times) previous topic - next topic

BusPirate helper app for your Android device

I finally managed to write a USB OTG helper script for talking to the BusPirate. (see my reply below for the link... this forum wouldn't let me post a link in this message, but would let me reply to it with a link? wierd).

The biggest problem I have with the BusPirate is that on the human side it speaks in very terse, hard to remember, codes.

The point of this script is to make that easy by providing a list of commands, with clear, English, descriptions, which then enter the code for you. You can edit it, then send that code to the device and see the response. If you setup a complex code that you will use often, you can save that code into the list with your own description.

It runs in DroidScript: DroidScript is a free app for Android that lets you write apps in JavaScript / HTML5 /on your phone or tablet/. Let me make that clear... you can /write/ the app on your phone! If you plug in a keyboard, it's even pretty reasonable... but it also allows you to connect your workstation via browser and has a pretty nice IDE.

I'd love to hear from anyone about what features should be added or problems you have with it.


Re: BusPirate helper app for your Android device

Reply #2
Added a dialog box which appears when you select UART mode, providing the options for baud rate, parity, data and stop bits, as well as the polarity and output levels supported by the BusPirate.

Re: BusPirate helper app for your Android device

Reply #3
Added a Voltmeter mode which displays repeated "d" commands in a nice big font. Makes it really easy to use as a meter and avoids a problem with the "D" command when used in DroidScript.
http://techref.massmind.org/techref/lan ... Multimeter

Re: BusPirate helper app for your Android device

Reply #4
Added a Parameter Entry Dialog
When a command needs parameters, we figure out what to ask for from the description. E.g. #KHz means "add an edit field in the dialog box with KHz as the prompt, and accept numbers only." So "Generate #KHz %Duty" will, when selected, popup a dialog asking for the KHz and Duty and after those values are entered, it will put them into the command string to be sent.

Re: BusPirate helper app for your Android device

Reply #5
Dang it! Why can I do
m3 1 1 1 1 1
And it drops right into uart mode but if I do
m5 1 1 1 1 1
It stops and asks me for the speed? Why can't I get into SPI mode in one line?

Re: BusPirate helper app for your Android device

Reply #6
Added the ability to define and display a list of options for the parameter selection wizard. e.g. 1=one 2=two. Somewhat limited at this point as the text of the option must be a single word. e.g. 1=this one results in two entries in the spinner: "1=this" and "one". The text before the = (if present) is used as the output.

Added parameter wizard entries for
- I2C
- SPI
- 2 Wire
- 3 Wire

Sadly, the SPI doesn't work because the BusPirate (firmware 6.1) doesn't accept the mode entry command in one line. I do
m3 1 1 1 1 1
And it drops right into uart mode but if I do
m5 1 1 1 1 1
It stops and asks me for the speed. Other modes (besides m3) also work fine. Just m5, SPI.

Corrected bug where old parameters accumulate between uses of the wizard. Wasn't clearing a global array between uses.

Re: BusPirate helper app for your Android device

Reply #7
[quote author="JamesNewton"]Dang it! Why can I do
m3 1 1 1 1 1
And it drops right into uart mode but if I do
m5 1 1 1 1 1
It stops and asks me for the speed? Why can't I get into SPI mode in one line?[/quote]

See reply in your other topic

Re: BusPirate helper app for your Android device

Reply #8
SPI mode is now working just fine. Thanks.


Re: BusPirate helper app for your Android device

Reply #10
Main console area now automatically adjusts point size to use the largest font possible (up to 14 point) while still getting the longest lines on the display. e.g. if you ask for PinState or something else that uses really long lines, it shrinks the font so it all fits. Once that scrolls off the top, if the lower lines are shorter, the font size will expand again. I was worried that it would cause problems with the number of lines that would fit changing, but in practice, I don't think that's an issue... time will tell.

Re: BusPirate helper app for your Android device

Reply #11
Big update! Adds a scaling factor to the value displayed in Voltmeter mode, and a calibrate button which powers up the internal supplies and explains how to connect a potentiometer so that the input voltage can be scaled, and the +5 power supply can be used as a voltage reference to calibrate the potentiometer.

In order to automatically turn on the power supply, the app now tracks the BusPirate mode, and if it's in HiZ, it automatically switches to 1-Wire (can't turn on power in HiZ) and then switches back when finished.

Sadly, it doesn't appear that the USB OTG interface on the phone can handle a continuous stream of data. This may be a limitation of my phone (currently a Samsung Galaxy 6) or of DroidScript. So... O'scope ain't going to happen!

Let me know if anyone else has a BusPirate working on an OTG connection in "D" or 0x15 binary mode.

Re: BusPirate helper app for your Android device

Reply #12
[quote="JamesNewton]In order to automatically turn on the power supply, the app now tracks the BusPirate mode, and if it's in HiZ, it automatically switches to 1-Wire (can't turn on power in HiZ) and then switches back when finished.
[/quote]

I would advise against powering the target when not in HiZ mode, since HiZ implies HiZ (i.e. not interfering with the circuit). Not powering the target in HiZ is expected behaviour!