Skip to main content
Nets act as named interfaces to your instruments. After you configure your Nets, the Lager Client controls those instruments. Use either the CLI or the Python SDK. The examples below show how to command the common instrument types. These include power supplies, battery simulators, debuggers, and communication buses.

Setting Defaults

First, set default values for --box and for common nets. Defaults keep you from repeating them on every command:
With defaults set, you can run commands more concisely (e.g., lager supply voltage 3.3 instead of lager supply POWER voltage 3.3 --box my-lager-box). See the defaults reference for all options.

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):
OVP (Over-Voltage Protection) and OCP (Over-Current Protection) are safety thresholds. If the output voltage or current exceeds these limits, the supply automatically shuts off to protect your device. You can clear a tripped fault with lager supply POWER clear-ovp or clear-ocp.
Enable the output:
Disable the output:

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):
SOC (State of Charge) is the battery’s charge level as a percentage, from 0 to 100. An SOC of 50 simulates a half-charged battery. Use it to test how your device behaves at each battery level.
Set max charge and discharge current:

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:
Where DEBUG_NET is the name of your debug net. You can also use a default debug net if configured.

I2C and SPI Nets

For communicating with peripheral devices over I2C or SPI buses:

Programmatic Control with Python

The Lager Python SDK performs the same operations in code. Use it for more complex automation, or to integrate with a test framework. 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:
  2. Execute the script with Lager. Use the lager python command. It runs the script in the Lager Box environment, where the script can reach the connected hardware.
For detailed Python API documentation, see the Python Reference section.
For a more comprehensive example combining power supply control, firmware flashing, ADC measurement, and safe cleanup, see the demo script.

Next Steps

You’ve completed the Getting Started guide. Here’s where to go from here: