Skip to content

cronologic-de/webusb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WebUSB

Configure a Raspberry Pi Pico using SCPI over WebUSB.

This is used by cronologic GmbH & Co. KG in the development of time-to-digital converters, Gsps digitizers and pulse generators.

Project structure and building

This repository consists of two parts: The MCU firmware and the web frontend to control it. Check the readme files for each of these parts for instructions on how to build it.

The frontend is automatically deployed at https://cronologic-de.github.io/webusb/, feel free to check it out!

When cloning the repository, make sure to also initialize the SCPI parser library submodule at firmware/lib/scpi-parser, else the firmware won’t build. If you use git clone on the command line, adding --recurse-submodules should suffice.

Status

Work on this project had begun, but is currently paused due to a shift in priorities.

The completed parts are:

The main missing parts are:

  • Make the firmware understand the actual value-setting SCPI commands (#4). Since the library is already integrated, this is probably not a lot of work.
  • Make the frontend send SCPI commands on user interaction (#7) and read the current values on connect.
  • Instead of using Web Serial, create a real USBTMC device and connect to it using WebUSB.
    • This will require setting up different USB descriptors on the firmware side, as well as (obviously) replacing Web Serial with WebUSB in the frontend. The webusb-js-wip branch contains work-in-progress WebUSB code that was put on hold when we decided to use Web Serial instead.
  • Try out a WebUSB Platform Capability Descriptor for a plug-and-play experience on operating systems supporting it.

WebUSB or Web Serial?

Web Serial abstracts away low-level USB enumeration and protocol. In fact, it’s not limited to USB at all. If your machine has built-in serial ports, these can be accessed, too. You are limited to sending and receiving bytes (convertable into text, of course, if your protocol isn’t binary) and cannot perform any low-level interaction with the device.

However, WebUSB on the other hand only works if the operating system has not already claimed the device. This is why, unintuitively, you cannot use WebUSB to access a USB Serial device (also known as USB CDC) like the Pi Pico: The OS already claims exclusive access on the device by providing a serial port for it.

This is why we’ve stopped working on WebUSB and continued with Web Serial, at least for the prototype. Once we migrate from a CDC-presenting microcontroller to a USBTMC configuration, WebUSB might become the way to go again. Determining whether there are operating systems that automatically claim TMC devices, and if so, how to prevent that, is left as a future investigation.

License

The code in this repository is licensed under the Mozilla Public License 2.0. This more or less means that you can do with this code whatever you want, but if you improve the code you shall make your changes available ot others upon request. Please read the license for additional details.

We encourage you to contribute to this repository. By uploading to this repository you agree to make your changes available under the beforementioned license.

About

Configure a Raspberry Pi Pico using SCPI over WebUSB

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors