This project aims an ongoing and serious issue in my community - the community being that of hardware developers. The serious issue is how much hassle it is to communicate to devices over USB.
No more specialized chips. No more expensive one-off boards. No more issues forcing you to install root signing certificates or disable driver signing on Windows. Just sweet sweet USB.
This project falls in the realm of quazi-commercial. It's run through my company (NewAE Technology Inc.) to provide some needed business stuff (such as signed drivers for the USB devices), but it's not being run to make a lot of money. Instead it's run to solve an extremely frustrating problem.
Overview of the Solution
Several companies make awesome microcontrollers with USB interfaces. I most frequently use Atmel or Microchip devices, but there are also solutions from NXP, Cypress, and more.
These chips are cheap - Microchip has some (such as the PIC16F1454), which is only $1.50(!) in onsies. It's pretty basic (doesn't include a programmer), so if you want a more advanced chip see the Atmel XMEGA for under $5. Need high-speed? Also possible for a low cost... I use an Atmel SAM3U device in my ChipWhisperer-Lite project.
I'm providing firmware for these devices, along with a simple Python interface. Toggle IO pins, read from the ADC, send SPI or UART data. The Python code just uses libusb (via pyusb), so you can talk to this device with C/C++ instead too. But the idea of Python is to make a simple enough solution for most users.
So imagine something like this:
#Example of how I plan on the BSU API working, this will rely on #using libusb/pyusb for actual low-level USB comms. This just adds #an API for talking to the firmware in the device import bsu #BSU will support detection by USB serial number, along with a user #GUID, eliminating the requirement for a central repository of user #PIDs. This example just opens the first BSU device devlist = bsu.find() dev = bsu.open(guid=devicelist["guid"]) #Set IO pins high or low - by default will automatically set as #an output for high/low dev.set_io(5, True) #Read ADC channel voltage, channel auto-configured as analog #input by this call too v = dev.read_voltage(1) #Write something to an internal register in the chip - makes it easy #to extend the API to access peripherals not otherwise exposed dev.write_reg(0xAF, 0x22) #Avoid USB traffic delays with simple routines to wait for bits to be #set/cleared (i.e. for waiting status change) dev.wait_reg(0xAF, 1<<5) #Simple SPI routines and whatnot spidev = dev.spi(MOSI=1, MISO=2, SCK=3, autoCS=True) resp = spidev.write([0x0A, 0x0B, 0x0C]) #More advanced routines for stuff like AVR programming a target dev.program_avr(MOSI=1, MISO=2, SCK=3, flash=r"c:\somewhere\test.hex") #Maybe even FPGA programming via slave serial protocol? It's all #done with SPI so might be slow due to USB traffic but in a pinch #would work. I've already got some of this code on other platforms. dev.program_xilinx_s6(DO=1, CLK=2, PGM=3, DONE=4, bitstream=r"c:\somewhere\test.bit") #I'd also like to implement a basic comm protocol, so you can use #BSU for talking to your existing device, but without having to #make a complex protocol. So something like: data = bsu.wait_for_data() #Where the underlying protocol gets the data along with variable #name somehow, so you can just do: #print data # data.temperature = 24.445 # data.timestamp = "10:04:33"
Buying the Units
This is far from the first solution aiming to provide firmware for an existing microcontroller. In fact a number of companies have offered this exact solution for a long time. Instead my project aims to make this less painful - rather than physically forcing you to somehow buy a preprogrammed microcontroller, you buy the microcontroller from a distributor (such as Digikey or Mouser), and program it yourself. If buying a lot of devices just buy them preprogrammed from the manufacture (such as at http://www.microchipdirect.com/).
With any luck some of the regular distributors such as Adafruit and SparkFun will pick these up and start selling them preprogrammed, maybe even they will be sold by Hackaday themselves? How easy would that be?
Why Doesn't This Exist?
There is lots of discussion about the problem with using USB in open-source products (in particular buying a VID, and getting signed drivers). It all costs money, something regular OS projects don't have. And according to membership agreements you can't share these between companies, so it's not something that a larger organization such as the OSHWA could do on behalf of members.
This means you need a commercial product which gets integrated into your project. The extremely low cost almost guarantees this won't make money (for me anyway, the distributors might). I'd have to sell >50000 licenses/year to even begin covering the cost of memberships + certificates. Making this a reasonable business would be looking at >1000000 licenses. While I enjoy dreaming big, it's just not happening.
That is basically the reason this doesn't exist yet. There is no business model. While the silicon vendors could provide the demo firmwares, they don't want to be caught supporting them. Because I'm running this as a small business, I'm perfectly happy to tell you get get stuffed if you email me looking for support on your $0.10 license.
It's not entirely open-source, since you can't modify the code and use my VID. But I'm planing on making the end device flexible enough you can do 'most things you want', and if I get enough requests for specific features might add it in.
Currently this project is very much in the 'idea' phase. It's something I've thought about on and off for a few years now. Having some cash from the Hackaday Prize 2014 helped encourage me use it to give back a bit to the community, as some of that money was used in getting HW & required USB membership to make this project a reality. I'm hoping to have time to get the firmware + software done over the summer, but we will see.
I'm going to use the Microchip PIC16F1454/5 device initially, as it's the cheapest thing I could find. It's also in a DIP package (along with SOIC and QFN), making it suitable for a range of targets - breadboard to tiny dongle.
Awesome. I really like my BusPirate, but more options are never a bad thing. At some point for the next revision of my #PIC-On-The-Go I'm going to need to write, borrow, or steal a bootloader to allow USB programming through a serial bridge. I bet you could write a bootloader that includes all the proprietary USB junk, and allow people to write their own firmware on top, that treats your stuff like a closed library.
Could be really cool.