Skip to main content
Nets act as named interfaces to your instruments. Once your Nets are configured, you can begin controlling those instruments using the Lager Client — via the CLI or Python SDK. The examples below demonstrate how to issue commands to common instrument types such as power supplies, battery simulators, and debuggers.

CLI Examples

Supply Nets

Power supply Nets can be controlled using the lager supply command. Set voltage and protection thresholds (note: this does not enable output):
lager supply POWER voltage 5 --ovp 5.1 --ocp 0.5 --box my-lager-box
Enable the output:
lager supply POWER enable --box my-lager-box
Disable the output:
lager supply POWER disable --box my-lager-box

Battery Nets

Some programmable power supplies support battery simulation. These can be controlled using the lager battery command. Set the simulated battery’s state of charge (SOC):
lager battery BATT soc 50 --box my-lager-box
Set max charge and discharge current:
lager battery BATT current-limit 1.0 --box my-lager-box

Debug Nets

Debugger nets (e.g. J-Link) can be used to flash firmware, erase memory, and inspect devices. Flash a hex file to your device:
lager debug DEBUG_NET flash --hex firmware.hex --box my-lager-box
Where DEBUG_NET is the name of your debug net. You can also use a default debug net if configured.

Programmatic Control with Python

For more complex automation or integration into test frameworks, you can use the Lager Python SDK to perform the same operations programmatically. The following example shows how to write a Python script using the Net API:
  1. Create a Python script. Save the following code to a file named flash.py:
    from lager.pcb.net import Net
    from lager.debug import flash_device, reset_device
    
    # Load a debug net by name
    debug_net = Net.from_saved("DEBUG_NET")
    
    # Reset and flash the firmware
    reset_device(halt=True)
    flash_device(["path/to/firmware.hex"])
    
    print("Firmware flashing complete.")
    
  2. Execute the script with Lager. Use the lager python command to run the script in the Lager Box environment, ensuring it has access to the connected hardware.
    lager python flash.py --box my-lager-box
    
For detailed Python API documentation, see the Python Reference section.