Net Overivew

Nets are automatically generated during the instrumentation process. You can list available nets for your development hardware either through the CLI tool, or via a Python script.

~  lager net --dut 1
name               type   channel
SPI.MOSI         analog         1
MOTOR_DR         analog         1
V3.3             analog         1
SPI.MISO         analog         2
V5               analog         2
SPI.CLK          analog         3
SPI.CS           analog         4
I2C.SDA          logic          0
I2C.SCL          logic          1
RST_BTN          gpio
PWR              power-supply
VBAT             battery
list_nets.py
 from lager import Net

 nets = Net.list_all()
 for net in nets:
     print(net)
~  lager python list_nets.py --dut 1
    {'name': 'SPI.MOSI', 'type': 'analog', 'channel': 1}
    {'name': 'MOTOR_DR', 'type': 'analog', 'channel': 1}
    {'name': 'V3.3', 'type': 'analog', 'channel': 1}
    {'name': 'SPI.MISO', 'type': 'analog', 'channel': 2}
    {'name': 'V5', 'type': 'analog', 'channel': 2}
    {'name': 'SPI.CLK ', 'type': 'analog', 'channel': 3}
    {'name': 'SPI.CS', 'type': 'analog', 'channel': 4}
    {'name': 'I2C.SDA', 'type': 'logic', 'channel': 0}
    {'name': 'I2C.SCL', 'type': 'logic', 'channel': 1}
    {'name': 'RST_BTN', 'type': 'gpio', 'channel': 0}
    {'name': 'PWR', 'type': 'power-supply', 'channel': 0}
    {'name': 'VBAT', 'type': 'battery', 'channel': 0}
~

Net Types

Each net has a corresponding type. Different types enable different functionality on a given net.

Analog

The Analog net type enables a given net to be inspected with an oscilloscope. This allows users to look at live trace captures for that net.

Logic

The Logic net type enables a given net to be inspected with a logic analyzer.

Note

Additionally both Analog and Logic nets can be combined into a communication bus type.

Power Supply

Power Supply nets can be controlled from a power supply. These nets are typically what a user would conect directly to a power supply.

Battery

Battery nets are nets that are typically connected to a 2 terminal battery. These nets can be controlled with a battery simulator either in dynamic mode which simulates the output of discharging or charging battery, or in static mode which simulates the output of a battery for a consant state of charge (SOC).

GPIO

GPIO net types can be controlled by the user, e.g. a reset line that the user can toggle. Or they can be read by the user, e.g. a FAULT line on a PMIC.

E-Load

E-Load nets can be electronically loaded with the following: - Constant Voltage - Constant Current - Constant Resistance - Constant Power

Debug

The Debug net type indicates that this net will be hooked up to either a JTAG or SWD debug probe.

Serial Logging

Serial Logging nets are used to capture log data from the development hardware. Normally these nets are assigned to UART or USB lines.

Note

Debug and Serial Logging nets are slightly different from other net types. Because they are used almost exclusively for debugging, these nets are incorporated directly into the Debug and Serial features.

Instantiating a Net

When working with nets using the Python library, they first need to be instantiated before they can be used.

instantiate_net.py
 from lager import Net, NetType

 def setup_nets(net, device):
     print("performing any necessary setup on nets being enabled")

 def teardown_nets(net, device):
     print("performing any necessary teardown on nets being disabled")

 mosi = Net.get('SPI.MOSI',
         type=NetType.Analog,
         setup_function=setup_nets,
         teardown_function=teardown_nets)

 sda = Net.get('I2C.SDA',
         type=NetType.Logic,
         setup_function=setup_nets,
         teardown_function=teardown_nets)

 pwr = Net.get('PWR',
         type=NetType.PowerSupply,
         setup_function=setup_nets,
         teardown_function=teardown_nets)

 battery = Net.get('VBAT',
         type=NetType.Battery,
         setup_function=setup_nets,
         teardown_function=teardown_nets)

Enabling and Disabling a Net

Before using a net it needs to be enabled. Enabling a net will trigger the setup callback function that is assigned during Instantiating a Net. Disabling a net will trigger the teardown callback function that is assigned.

enable_disable_net.py
 from lager import Net, NetType

 battery.enable()
 sda.enable()
 mosi.enable()

 battery.disable()
 sda.disable()
 mosi.disable()