element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Raspberry Pi
  • Products
  • More
Raspberry Pi
Blog Raspberry Pico as USB test device - part 1: the TinyUSB USBTMC profile
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Raspberry Pi to participate - click to join for free!
Featured Articles
Announcing Pi
Technical Specifications
Raspberry Pi FAQs
Win a Pi
GPIO Pinout
Raspberry Pi Wishlist
Comparison Chart
Quiz
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: Jan Cumps
  • Date Created: 29 Jan 2023 3:20 PM Date Created
  • Views 7165 views
  • Likes 14 likes
  • Comments 14 comments
Related
Recommended
  • raspberry
  • pico_usbtmc_scpi
  • pico
  • scpi

Raspberry Pico as USB test device - part 1: the TinyUSB USBTMC profile

Jan Cumps
Jan Cumps
29 Jan 2023
Raspberry Pico as USB test device - part 1: the TinyUSB USBTMC profile

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. 

image

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:

image

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:

image

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.

image

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:

image

scpi_switch_usbtmc_20230129.zip

link to all posts

  • Sign in to reply

Top Comments

  • Jan Cumps
    Jan Cumps over 2 years ago +1
    One minute extra quality time, and I got it working: I'm attaching the current VSCode project to the blog
  • Jan Cumps
    Jan Cumps over 2 years ago +1
    One of the advantages using USBTMC is that this Pico will enumerate identical to commercial instruments. A Keithley meter, Rigol power supply and the Pico are connected. For LabVIEW (and PyVISA), they…
  • Jan Cumps
    Jan Cumps over 2 years ago

    One of the advantages using USBTMC is that this Pico will enumerate identical to commercial instruments. 

    image

    A Keithley meter, Rigol power supply and the Pico are connected. For LabVIEW (and PyVISA), they are immediately recognised as VISA instruments.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • DAB
    DAB over 2 years ago

    Very useful tool.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • Jan Cumps
    Jan Cumps over 2 years ago

    One minute extra quality time, and I got it working:

    image

    I'm attaching the current VSCode project to the blog

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • Jan Cumps
    Jan Cumps over 2 years ago in reply to Jan Cumps

    The reply is prepared, not sent though ...

    image

    But this is an acceptable state for a day of work

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • Jan Cumps
    Jan Cumps over 2 years ago in reply to Jan Cumps

    More progress: I get the input, and the parser can translate it:

    image

    I haven't got replies working yet. The example uses a pre-existing reply, and in my case the SCPI parser has to generate a dynamic reply. And it does that in chunks. I need to unwind the little state machine from the TinyUSB example ...

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
>
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube