SPI command-line interface program for Linux

USB AVR Programmer and SPI interface. Adafruit's USBtinyISP.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
AceJohnny
 
Posts: 3
Joined: Fri Sep 10, 2010 4:43 am

SPI command-line interface program for Linux

Post by AceJohnny »

I was disappointed that avrdude's SPI terminal mode didn't work with the USBTinyISP*, I wrote this SPI CLI program for Linux, source attached.

Turned out to be surprisingly easy, thanks the the example code, straightforward avrdude source and USBTiny firmware source.

The program uses the linenoise CLI code, and depends on libusb.

As SPI is a simultaneous write/read protocol, I didn't bother really implementing the "read" command, as writing "0 0 0 0" does the same thing.

It writes bytes by chunks of 4, since that's what the USBTiny does, and SPI commands usually come in that size.

It's still a pretty raw program, but it does what I needed, so I hope it can be useful to someone else, if only as a starting point.

*This is because avrdude tries to bit-bang SPI by controlling the pins directly. While the USBTinyISP supports that, no-one implemented it in avrdude which it naively crashes.
Attachments
spicli.zip
source code for the spicli
(51.25 KiB) Downloaded 293 times

Locked
Please be positive and constructive with your questions and comments.

Return to “USBtinyISP”