Programmatic Control and Monitoring Of PCB Nets

If you are familiar with PCB design you know that Nets are a collection of pads and traces that are electrically connected together (but also a basketball team in Brooklyn).  

For example, you might have a net named {% c-line %}I2C_SDA{% c-line-end %} which is the I2C data line between the master and 1 or more slaves. They all share a common trace.

Lager’s API is unique because we categorize net types, and give each type specific functionality. For example you might have a Device-Under-Test (DUT) with the following nets:

{% c-block language="bash" %}
% lager nets --dut 197
name          type              channel
V_IN          power-supply      1
COIN          battery           1
BOOT          gpio              0
EN            gpio              1
PWM           analog            0
TEMP_SNS      analog            1
I2C_SDA       logic             0
I2C_SCL       logic             1
{% c-block-end %}

Each net has been given a category. Based on that category a user knows what functionality they have over a given net.

For example, the {% c-line %}V_IN{% c-line-end %} net has a net type of {% c-line %}power-supply{% c-line-end %} which means it can supply power to the system(i.e. your DUT).

To supply a voltage of 5V to a system a user can do:

{% c-line %}lager supply V_IN voltage 5{% c-line-end %}

You could also add over-voltage and over-current protection to this net:

{% c-line %}lager supply V_IN voltage 5 --ovp 5.1 --ocp 0.25{% c-line-end %}

The {% c-line %}BOOT{% c-line-end %} net has a net type of {% c-line %}GPIO{% c-line-end %} which means we can set a TTL value on it, or we can read from it.

Let’s go ahead and set the value of the {% c-line %}BOOT{% c-line-end %} net to 0V:

{% c-line %}lager gpio BOOT output LOW{% c-line-end %}

Now let’s set it high:

{% c-line %}lager gpio BOOT output HIGH{% c-line-end %}

Next we see {% c-line %}analog{% c-line-end %} nets {% c-line %}PWM{% c-line-end %} and {% c-line %}TEMP_SNS{% c-line-end %}.

Analog nets are a particularly powerful net type because they have oscilloscope functionality. That means, for example, a user can set a trigger on a voltage and edge type, and then capture the waveform. Analysis on an {% c-line %}analog{% c-line-end %} net is also possible, for example capturing {% c-line %}VMax{% c-line-end %}, {% c-line %}Vmin{% c-line-end %}, {% c-line %}Duty Cycle{% c-line-end %}, etc.

Here's an example of setting a trigger on the {% c-line %}PWM{% c-line-end %} net:

{% c-line %}lager analog PWM trigger edge --source PWM --slope both --level 2.5{% c-line-end %}

or measuring positive duty cycle:

{% c-line %}lager analog PWM measure dc-pos{% c-line-end %}

In conclusion, the advantage of having what we call Net-centric control of your DUT is that it makes it very clear how the system is instrumented, and what you are able to control or observe.  Instead of wrangling multiple interfaces across multiple tools (e.g. power supply, oscilloscope, JTAG debugger) you can programmatically interact directly with your DUT with a single unified interface.

Reach out to learn more about Lager's hardware test automation platform.

Try One Month Free