I have written a
USBTMC/USB488 class driver for microcontrollers (link updated 2020-07-10), based on the TinyUSB library.
I'm hoping it'll be merged into the TinyUSB stack soon.USBTMC/USB488 (in case you don't know) is the USB protocol used by test and measurement equipment (like oscilloscopes/DMM/etc...). In the market, it's in the process of replacing GPIB (IEEE488) interfaces. In hobby projects, USB CDC is the most common interface, often implemented via FTDI USB interface ICs.
I started writing it after searching for prior art. I was unable to find any open-source implementations which are standards compliant (or every mostly complete). TinyUSB won my vote due to its goal of compatibility with many different MCUs. I didn't want to have to ever port my code between USB stacks when switching MCUs. It also is developing with a goal of thread-safety so it can be used with a RTOS. "Tiny" is a good feature too; I can fit my implementation on a STM32F042 with 6 kB of RAM and 16 kB of flash with enough space left for application code. In the near future, I think the project will be limited to 16/32-bit little-endian MCUs, but this may expand in the future.
The USBTMC class driver implements most of the USB488 protocol (read STB, flash a light, clear, trigger, write, read, abort read or write, etc...), though some optional features are presently missing (like changing between remote/local states). Performance may also be somewhat lacking (I've not been optimizing for throughput), though it can be improved. There's also only a minimal application layer at the moment, it'll be up to you to implement a IEEE 488.2 state machine, SCPI (or perhaps use the
scpi-parser library), and your actual product code.
So, if you are working on a micro-controller project which needs a message-based command interface, you may want to look into using this library.
USBTMC specification download page(zip file)-Nathan
PS: This protocol seems difficult enough that many products have non-conforming implementations. (Last time I checked my Siglent SDG2042X, it didn't support CLEAR, as an example.)