There's a standard profile for USB test devices, called USBTMC. If your instrument supports it, it becomes a plug-and-play device for the likes of LabVIEW. The Raspberry Pico examples come with a set of TinyUSB profile examples, and USBTMC is one of them. In this post, I run the example on a Pico and check if my operating system and the LabVIEW utilities recognise it. This started as a blog to investigate if the Pico + TinyUSB Test and Measurement protocol example renders a device that's recognised by LabVIEW. But I had a bit of tailwind. At the end of the blog you'll find the source for a first shot at a real USBTMC lab programmable instrument. |
Check if the instrument is detected upon plugin via Zadig
The example does not implement an instrument, but it enables USB and makes itself known as a usbtmc. When the firmware is loaded and running, the first test should be if the device is recognised. I use the Zadig log screen for that. Good news immediately:
Check if the usbtmc device driver is loaded
This one is obvious from the Zadig screen (Usbtmc driver version 16.x loaded), but let's look at the device manager:
More success. The appropriate driver - exactly the same one as used for my usbtmc compatible Keatley meter - is loaded. You recognise the properties that Zadig logged earlier.
Test if NI-Visa recognises it
If a device enumerates as usbtmc, the NI-Visa tools should detect it. The easiest way to see that is by starting NI-MAX, the NI instrument explorer.
That completes this test. The device does not have any intelligence, but is able to make itself known as a usbtmc. And software recognises that after plugging it in a USB bus. This 'll be my first step to try and write a Pico "native" test instrument with the C-SDK.
Preview of a working project
I made a SCPI Pico instrument that worked via USB-serial before. I've ported it to the USBTMC profile. It is working, but barely. The same commands are supported,
Here's the VSCode project. Use it for an initial view only. The reply engine isn't working stable yet (activity for the next blog post).
Don't forget to add these two variables to your VSCode user environment:
Top Comments