# Pm100d Device ```{toctree} :hidden: :maxdepth: 2 ``` ## Overview A plesty device for pm100d built on the Plesty standard. ## Installation ```bash git clone https://gitlab.com/plesty/hub/devices/plesty-pm100d.git cd plesty-pm100d uv sync ``` ## Running as a TCP server Make sure the device is connected and powered on, then: ```bash uv run python -m plesty.pm100d --tcp-port 5555 -a "USB0::0x1313::0x8078::::INSTR" ``` Without hardware, `--mock` serves an in-memory SCPI simulator with the same command contract as the real instrument. ## Troubleshooting ### Driver configuration In Device Manager the meter must appear as **USB Test and Measurement Device (IVI)** — confirm it is the PM100D under Properties → Details → Hardware Ids (`VID_1313&PID_8078`). If the Thorlabs OPM/TLPM driver owns it, VISA reads time out (`VI_ERROR_TMO`) even though the session opens; run the **Thorlabs Power Meter Driver Switcher** (installed with the Thorlabs power-meter software) to switch the meter back to the USBTMC/VISA driver, or rebind via *Update driver*. Close the Thorlabs Optical Power Monitor software completely — it lingers in the tray and holds the instrument exclusively. The NI-MAX test panel is the arbiter: if `*IDN?` times out there too, the problem is driver/instrument-side, not this module. ### Finding the VISA address ```bash uv run python -c "import pyvisa; print(pyvisa.ResourceManager().list_resources('USB?*::INSTR'))" ``` Pass the full resource string including the serial number (`USB0::0x1313::0x8078::P0001234::INSTR`) as `--address`. ### `list_resources()` / server startup hangs and Ctrl+C is dead The process is stuck inside the VISA library's native code, so the interpreter never gets to deliver `KeyboardInterrupt` — kill it from another terminal or Task Manager. Then work through, in order: 1. **Wedged meter** — a halted USBTMC endpoint can stall the whole VISA enumeration. Power the meter fully off (hold the power button), wait ~10 s, replug USB (ideally another port), retest. 2. **Another wedged USBTMC instrument** — enumeration touches every device in the *USB Test and Measurement Devices* category; any one of them can stall the scan. Unplug or disable them one by one to find the culprit. 3. **Stuck NI-VISA services** — if the hang persists with no USBTMC devices attached, **reboot the PC** (resets the NI services and the USB host controller; this is the usual fix). 4. **Damaged VISA install** — if NI MAX also freezes expanding *Devices and Interfaces* after a reboot, repair NI-VISA via NI Package Manager; if a second vendor VISA (Keysight, R&S) is installed, set NI-VISA as primary in the VISA conflict manager. ### USB connection issues - **Every command times out** although the session opened: power-cycle the meter and replug the USB cable — USBTMC devices wedge into a non-answering state that survives server restarts. (An open session proves nothing: `check_operatability()` only checks that the session object exists.) - **Only the first command after (re)connect fails**: a previously timed-out query can leave an unread response in the USBTMC buffer. The failure clears itself after one successful command — retry before digging deeper. ## Reference The **Parameters**, **Functions** and **Standard Methods** pages in the navigation are generated automatically from the device schema by `plesty docs` — you do not edit them by hand. Keep this page focused on the QuickStart above.