tobyjaffey/bus-ninja

Bus Pirate protocol support

Opened this issue · 4 comments

Adding support for either of the Bus Pirate protocols (binary or ASCII) will allow for Bus-ninja to be used as a AVR programmer, along with Avrdude.

Yup. Noone bothered to implement it though ;-). I for example thought about that while hacking on busninja, but then figured out implementing my own adhoc protocol(s) for needs I had/have is easier and more scalable. Feel free to implement it of course.

Well, I just wish to use Avrdude with Bus Ninja.

A short look at the sources made me think that implementing the ASCII Bus Pirate protocol wouldn’t be too hard a task.

Per my reading of avrdude/buspirate.c, Avrdude interfaces the Bus Pirate as follows (expect + send pairs; ASCII mode).

""  \n\n
(anything)  #\n
"Are you sure?" y\n
RESET   m\n
(number)". SPI"(anything)">"    (number)\n
(number)"."(anything)"Normal (H=3.3V, L=GND)"(anything)">"  (number)\n
"SPI>"  (four 0x data bytes)
# cycle below this point
"WRITE 0x"(byte)" READ: 0x"(byte)"\n"(four times)">"    (four more 0x data bytes)

One way to implement this in Bus Ninja is to add the # (prompting for y, and responding RESET\n\n, but otherwise either reset or no-op) and m (menu) commands, while also providing the SPI> prompt in the latter command’s menu (it seems to be only needed once), and a Bus Pirate-compatible WRITE READ output as an option (either run-time or compile-time).

Also add ability to use with sigrok / pulseview. Bus pirate is supported in logic analyzer mode:

https://sigrok.org/wiki/Supported_hardware