Introducing SPIDriver

Over the past decade, I've spent most of my time working on SPI devices one way or another. There is always a stage in the project where the thing needs to be directly controlled by a PC. Sometimes this is just for a minute to confirm that it's working, and sometimes permanently for a test or debug setup. SPIDriver is my attempt to make a better tool for doing this.
This image was deleted by MailChimp when they shut down TinyLetter.

Its most obvious feature is the built-in screen, which shows the live SPI traffic on a logic-analyzer display. But it has a bunch of other small features to make it easy to work with, like color-coded hookup wires and continuous current measurement. SPIDriver connects as a USB serial device, and has a simple protocol for talking SPI over the serial connection. There are C,C++ and Python libraries for driving it, as well as a GUI tool for interactive use. You can read more about SPIDriver on Crowd Supply - it's scheduled to launch next week on June 12. You can also sign up for a launch alert on that page.

I'm super excited about SPIDriver -- it's a lot of fun to use. And it's also exciting to be working with Crowd Supply for the first time, who are doing a great job of making crowd-funded hardware respectable.

Making SPIDriver

SPIDriver's hardware is fairly minimal. There's an FTDI 230X UART, an LCD panel, current and voltage sensors, and the microcontroller. The microcontroller's job is to drive the UART and SPI ports, run the various analog sensors, and of course drive the graphics display, which is a bitmapped 1.8" LCD 128x160 color panel. The 8-bit controller is working quite hard to update the whole screen 50 times per second, while also transferring data between UART and SPI.
This image was deleted by MailChimp when they shut down TinyLetter.
The microcontroller is a Silicon Labs EFM8. The EFM8s are quite fast, super-robust, and best of all are supported by MyForth. MyForth is a programming language and development setup written by Forth and embedded 8051 veterans Charley Shattuck and Bob Nash. It's both a high-level Forth-like language and very specific to the 8051 CPU, which makes it ideal for SPIDriver because of its high-speed graphics. 

In all there are four threads running on the SPIDriver:

The first three all run on interrupts, while the graphic updates run as a background thread using all the spare cycles.

The whole thing fits in a little under 4K, which is 3K of code and 1K for the fonts. Fitting a nice antialiased font in 1K requires some kind of trick. The trick in this case is to only include the actual characters used by the text on the screen. All the on-screen text can be drawn using only the characters "ABCIKMOSVm" - so these are the only ones included in the font:
This image was deleted by MailChimp when they shut down TinyLetter.The hex digits are a different, smaller font. I was really pleased to find this collection of tiny but readable fonts. The hex characters encode nicely in a couple of hundred bytes:This image was deleted by MailChimp when they shut down TinyLetter.

The whole setup took me back to my first job writing games for incredibly limited British 8-bit home machines, like this one.  Our 8-bit CPUs are much quicker than those original ones. The EFM8 can run at 27 MIPS and costs about 27 cents. Those numbers were very different for a 80's era Z80 or 6502!