Two test sockets can share a measuring instrument yet require different settings and readings. If their commands interleave, each socket may receive a valid-looking value from the other’s measurement. Establish ownership over the complete instrument operation, not only over individual communication calls.
NI’s VISA locking documentation describes restricting access so that another session cannot intervene between related operations. Confirm the scope supported by the interface and application architecture; a local software lock does not automatically coordinate every external controller.
Define the protected operation
Identify which actions must remain together: configuration, switch routing, stimulus setup, trigger, completion check, readout, and any required restoration. Locking only the read call leaves earlier configuration exposed to changes from another test.
Associate ownership with the socket, board, test step, and acquisition attempt. Keep the current owner visible in diagnostic logs, together with acquisition and release times. A generic “resource busy” message is less useful than knowing which operation holds the resource and whether it is progressing.
Review shared state
| Shared state | Potential interference |
|---|---|
| Measurement function and range | Another test changes interpretation |
| Instrument output buffer | A reader consumes another operation’s response |
| Fixture routing | The instrument measures the wrong socket |
| Status and event queues | One test clears another test’s completion evidence |
Include diagnostic utilities and manual front-panel activity in the ownership model where relevant. A production application may coordinate its own threads correctly while a separate service tool changes the instrument during a run.
Bound waiting and recovery
- Acquire ownership before changing shared state.
- Perform the complete defined operation.
- Store the result with its acquisition identity.
- Restore or document the remaining instrument state.
- Release ownership on every supported exit path.
Set a meaningful policy for waiting on the resource. A waiting socket should not be labeled as a product failure simply because another socket is still measuring. If the owner fails, recovery must establish the instrument state before granting it to the next operation.
Test with concurrent requests that intentionally use distinguishable signals and settings. Verify that no result swaps occur and that timeouts do not leave ownership permanently held. Repeat the check with a controlled error inside the protected operation.
Where throughput requires overlapping work, overlap only operations that are demonstrably independent. Reducing the protected region without understanding shared state can create rare data corruption that is difficult to reproduce. The successful design makes ownership and result association explicit enough to inspect from a recorded event sequence.
Move from reading to a build-ready project
Use the fabrication and assembly checklists to prepare drawings, production files and test requirements.
Open the DFM checklist