A Powered USB Board Can Still Be Missing From Linux

A Raspberry Pi Pico 2 can have normal supply voltages while the computer sees no device on its Universal Serial Bus (USB) port. Open only the two data lines on a switchable adapter and compare the board’s supply voltages with Linux’s device inventory. Restore the links afterward to check that the same port can see the boot device again.

Connect the host, adapter and Pico 2

A Raspberry Pi 4 USB-A port connects through an Adafruit 5972 adapter and USB-C to Micro-B data cable to a Pico 2. VBUS and ground switches stay closed and both data switches are open in the illustrated trial. A Fluke 115 measures header pin 40 and then pin 36 against ground pin 38.
The middle trial opens D+ and D− while leaving the supply and return connected. Measure one Pico header voltage at a time. Full-size PNG · Editable SVG

Use one Raspberry Pi 4 Model B running Raspberry Pi OS with Python 3 and its normal power supply. Reserve one black USB 2.0 Type-A host port for the whole experiment. Plug the Adafruit 5972 adapter’s USB-A end into that host port. From its USB-C receptacle run a StarTech USB2CUB1M data cable to the Micro-B port of a bare, non-wireless Raspberry Pi Pico 2. The Pico 2 has the RP2350 microcontroller. No external circuitry or supply connects to its headers. Disable desktop removable-media automount, or run the experiment from a console without an automounter. The operating system might otherwise mount the mass-storage interface independently of the script.

The 5972 has one switch on each of the four USB 2.0 paths. Switch 4 carries VBUS, the bus supply. Switch 1 carries signal ground (GND). Switch 2 carries D+ and switch 3 carries D−, the pair that carries data as a voltage difference. Follow the adapter’s printed labels. Keep VBUS and GND on for each connected trial, and change D+ and D− together only after unplugging the adapter from the host. The adapter and cable handle the Type-C configuration-channel (CC) wiring. Connector orientation and cable stay fixed.

On the C&K SDA04H1SBD switch in this adapter, 100 mA at 5 V direct current is a rated contact point. The Pico 2 datasheet gives typical boot-ROM examples of 5.47 mA idle and 14.26 mA during boot, not maximum current guarantees. For scale, the published typical 14.26 mA is about 14% of the rating at 5 V. This is an experiment for the specified bare board at 5 V. Leave phones, unverified loads and USB Power Delivery equipment out of this fixture.

Use the Fluke 115 digital multimeter in its direct-voltage (DC V) mode. On a Pico 2 with soldered headers, clip the black COM lead to physical pin 38, GND, with power disconnected. Move the red lead in the V/Ω socket from pin 40, VBUS, to pin 36, 3V3(OUT), to read the rails in turn. Use a protected probe tip so it cannot bridge adjacent pins. Verify the header orientation from the official pin map. The 6.000 V range shows millivolts and the nominal voltage input exceeds 10 MΩ, so at 5 V the meter draws less than about 0.5 µA. That is a small load compared with the manufacturer’s typical board current.

Keep the boot mode and host port fixed

Enumeration is the process in which a USB host discovers a device and reads identification information from it. To use the same built-in device in every connected trial, hold the Pico 2’s BOOTSEL button as you reconnect power by plugging the adapter into the host. Then release it. This starts the RP2350 boot program from read-only memory (ROM) without relying on a particular flashed application. The default ROM USB identity reports vendor ID 2e8a and product ID 000f. A different identity is outside the specified control, even if the hardware otherwise works. Use this experiment without writing a file to the Pico.

Order of the four observations
StageD+D−Pico railsTarget port
unplugged——Near zeroEmpty
data_onOnOnOnBoot ROM
data_offOffOffOnEmpty
restoredOnOnOnBoot ROM
  1. Leave the adapter disconnected from the host. Wait for both Pico voltages to reach near zero and capture unplugged. Disconnect any other RP2350 boards in ROM boot mode. Leave ordinary devices such as the keyboard connected throughout.
  2. Close all four switches. Reconnect to the selected host port while holding BOOTSEL. After releasing the button, wait at least two seconds and until the meter readings are stable. Read both rails and capture data_on. The control needs exactly one device with the expected boot ID.
  3. Unplug at the host and let the Pico lose power. Turn only D+ and D− off. Hold BOOTSEL as you reconnect again, then repeat the two voltage measurements and capture data_off. Keep the same Type-C plug orientation.
  4. Unplug again and return both data switches to on. Repeat the same ROM boot procedure and readings for restored. The boot ID should return to the same Linux port path. The device address on that port may change after reconnecting.

Save the meter values with the USB observation

For each stage replace the example variables below with the actual measured voltages and the corresponding stage name. The blank worksheet keeps the physical settings and measurements together. Work on the same host without rebooting between observations. The recorder reads Linux’s system file interface, sysfs, four times separated by 0.25 seconds. It records bus, port, assigned device address and USB IDs without serial numbers. It does not mount or write to a device. If Linux changes its USB inventory between these reads, wait for it to settle and repeat that capture in its current fixture state.

For example, at data_on type python3 usb_visibility.py capture data_on --vbus MEASURED_VBUS --rail MEASURED_3V3 > data_on.json, using numerical values in volts in place of the uppercase words. Repeat the command with the updated stage, voltage readings and filename each time. An empty output file after a failed capture is not a valid observation.

Then run python3 usb_visibility.py compare unplugged.json data_on.json data_off.json restored.json. The comparison requires 4.50–5.50 V VBUS for the three connected trials, following the board’s stated 5 V ±10% range, plus 3.10–3.50 V on its nominal 3.3 V output as a fixture screen. Across connected trials the VBUS spread must be at most 0.25 V and the regulated rail spread at most 0.10 V. These margins screen stable readings. They do not capture brief voltage dips or characterize regulation. The unplugged readings must be within 0.10 V of zero.

A successful comparison also requires an empty target port in the unplugged and powered data-open snapshots, and the correct boot ID at the same port in both connected controls. An unexpected device at the target port is unresolved even if it has a different identity. Exit 0 supports the observed separation of power and enumeration in these samples. Exit 1 indicates an unresolved observation. Exit 2 reports a file or parsing problem. A snapshot cannot rule out a brief event between reads or prove that a storage volume mounted. If the control fails, check BOOTSEL timing, port and cable before interpreting the data-off trial. If a rail fails, check the power switches first.

Predict what restoration should change

Suppose the data-off run shows 4.94 V at VBUS and 3.29 V at 3V3(OUT), with nothing at the known port. After restoration both voltages are almost identical and 2e8a:000f appears there at a new USB address. Which part of the observation changed?

Answer

Linux can now enumerate the boot ROM over the restored data pair. Both supply readings were already present. A changed assigned address is expected after re-enumeration and carries less weight than the fixed physical port and the expected ID. The stated values illustrate the reasoning and are not bench results.

Full Python recorder and checker

Download the standalone script or use the experiment archive. The included synthetic-observations.json lets you run the comparison without connecting equipment. The tests use mock Linux files and calculated examples. Collect your own voltages and observations for the physical experiment.

Complete source for usb_visibility.py
#!/usr/bin/env python3
"""Record and compare USB power and RP2350 BOOTSEL visibility on a Linux host."""

import argparse
import json
import math
from pathlib import Path
import re
import sys
import time


STAGES = ("unplugged", "data_on", "data_off", "restored")
BOOT_ID = ("2e8a", "000f")
SYSFS = Path("/sys/bus/usb/devices")
PORT = re.compile(r"([1-9][0-9]*)-[1-9][0-9]*(?:\.[1-9][0-9]*)*")
HUB = re.compile(r"usb[1-9][0-9]*")
USB_ID = re.compile(r"[0-9a-f]{4}")


class EvidenceError(ValueError):
    """These observations are insufficient for the experiment."""


def require(condition, location, message):
    if not condition:
        raise EvidenceError(f"{location}: {message}")


def usb_text(directory, name):
    return (directory / name).read_text(encoding="ascii").strip()


def scan(root=SYSFS):
    entries = sorted(Path(root).iterdir())
    require(any(HUB.fullmatch(entry.name) and entry.is_dir() for entry in entries),
            "sysfs", "no USB root hub is visible")
    devices = []
    for entry in entries:
        match = PORT.fullmatch(entry.name)
        if not match:
            continue
        vendor = usb_text(entry, "idVendor").lower()
        product = usb_text(entry, "idProduct").lower()
        require(USB_ID.fullmatch(vendor) and USB_ID.fullmatch(product), entry.name,
                "unreadable USB identity")
        bus_text = usb_text(entry, "busnum")
        address_text = usb_text(entry, "devnum")
        require(bus_text.isdecimal() and address_text.isdecimal(), entry.name,
                "unreadable USB bus/address")
        bus, address = int(bus_text), int(address_text)
        require(bus == int(match[1]) and 1 <= address <= 127, entry.name,
                "inconsistent USB bus/address")
        devices.append(
            {"port": entry.name, "vendor": vendor, "product": product,
             "bus": bus, "address": address}
        )
    return devices


def stable_devices(scanner=scan, pause=time.sleep):
    first = scanner()
    for _ in range(3):
        pause(.25)
        require(scanner() == first, "sysfs", "USB device inventory changed during capture")
    return first


def voltage(snapshot, name):
    value = snapshot.get(name)
    require(type(value) in (int, float) and -10 <= value <= 10 and math.isfinite(value),
            snapshot["stage"], f"{name} needs a finite numeric reading in volts")
    return value


def validate_snapshot(record, expected_stage):
    require(isinstance(record, dict) and record.get("stage") == expected_stage,
            expected_stage, "out-of-order or missing stage")
    bus_v, rail_v = (voltage(record, key) for key in ("vbus", "rail"))
    devices = record.get("devices")
    require(isinstance(devices, list) and len(devices) <= 256, expected_stage,
            "invalid USB device list")
    ports = set()
    for item in devices:
        require(isinstance(item, dict), expected_stage, "invalid USB device record")
        identifiers = (item.get("vendor"), item.get("product"))
        require(all(isinstance(part, str) and USB_ID.fullmatch(part) for part in identifiers),
                expected_stage, "invalid four-digit USB identity")
        port = item.get("port")
        match = PORT.fullmatch(port) if isinstance(port, str) else None
        bus, address = item.get("bus"), item.get("address")
        require(match and type(bus) is int and bus == int(match[1])
                and type(address) is int and 1 <= address <= 127, expected_stage,
                "invalid bus, USB port path, or address")
        require(port not in ports, expected_stage, "duplicate USB port")
        ports.add(port)
    if expected_stage == "unplugged":
        require(abs(bus_v) <= .10 and abs(rail_v) <= .10, expected_stage,
                "the disconnected board must read near zero")
    else:
        require(4.50 <= bus_v <= 5.50, expected_stage, "VBUS outside 4.50–5.50 V")
        require(3.10 <= rail_v <= 3.50, expected_stage, "3.3 V rail outside the fixture window")
    expected_count = 1 if expected_stage in ("data_on", "restored") else 0
    boot_devices = [d for d in devices if (d["vendor"], d["product"]) == BOOT_ID]
    require(len(boot_devices) == expected_count, expected_stage,
            "need one RP2350 ROM device" if expected_count else "found an RP2350 ROM device")
    return bus_v, rail_v, ports, boot_devices


def compare(records):
    require(isinstance(records, list) and len(records) == len(STAGES),
            "comparison", "need four ordered stage records")
    disconnected, on, off, restored = [validate_snapshot(item, stage) for item, stage in zip(records, STAGES)]
    port = on[3][0]["port"]
    require(port == restored[3][0]["port"], "restored", "use the same physical port")
    require(port not in disconnected[2], "unplugged", "the target port already shows a USB device")
    require(port not in off[2], "data_off", "a USB device is still visible at the target port")
    bus_values = [row[0] for row in (on, off, restored)]
    rail_values = [row[1] for row in (on, off, restored)]
    require(max(bus_values) - min(bus_values) <= .25 + 1e-12 and
            max(rail_values) - min(rail_values) <= .10 + 1e-12, "comparison",
            "powered observations do not agree within the rail margins")
    return port


def unique_object(pairs):
    result = dict(pairs)
    require(len(result) == len(pairs), "JSON", "duplicate object fields")
    return result


def load(path):
    with Path(path).open(encoding="utf-8") as file:
        raw = file.read(65_537)
    require(len(raw) <= 65_536, path, "snapshot exceeds 65536 characters")
    return json.loads(raw, object_pairs_hook=unique_object)


def main(argv=None):
    parser = argparse.ArgumentParser(description=__doc__)
    sub = parser.add_subparsers(dest="command", required=True)
    capture = sub.add_parser("capture")
    capture.add_argument("stage", choices=STAGES)
    capture.add_argument("--vbus", required=True, type=float)
    capture.add_argument("--rail", required=True, type=float)
    evaluate = sub.add_parser("compare")
    evaluate.add_argument("snapshots", nargs="+")
    args = parser.parse_args(argv)
    try:
        if args.command == "capture":
            record = {"stage": args.stage, "vbus": args.vbus, "rail": args.rail,
                      "devices": stable_devices()}
            voltage(record, "vbus")
            voltage(record, "rail")
            print(json.dumps(record, indent=2, allow_nan=False))
        else:
            inputs = args.snapshots
            require(len(inputs) in (1, 4), "comparison", "use one four-record list or four individual files")
            records = load(inputs[0]) if len(inputs) == 1 else [load(path) for path in inputs]
            port = compare(records)
            print(f"SUPPORTED at {port}: powered with data open; RP2350 ROM returned after restoration.")
    except (OSError, UnicodeError, json.JSONDecodeError) as exc:
        print(f"ERROR: {exc}", file=sys.stderr)
        return 2
    except EvidenceError as exc:
        print(f"UNRESOLVED: {exc}", file=sys.stderr)
        return 1
    return 0


if __name__ == "__main__":
    sys.exit(main())

Related measurements and primary sources