> ## Documentation Index
> Fetch the complete documentation index at: /docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Digilent WaveForms

> Use an Analog Discovery or Digital Discovery for digital capture, analog measurements, waveform generation, and supply control.

A Digilent WaveForms device, such as an Analog Discovery or Digital Discovery, can capture and decode digital signals, record analog inputs, drive a waveform output, and power a small target. Use it when one bench instrument needs to both stimulate the target and observe the result.

Capabilities differ between models. Inlay uses a Digilent device only if it has a logic analyzer, and checks which other instruments the connected device provides. Examples on this page use an Analog Discovery 3 (AD3).

## Prepare

1. Connect the device with a data-capable USB cable.
2. Close the WaveForms application and any other program using the device.
3. Ask Inlay to check the device. The first time, approve the setup prompts:
   * **Install Python 3?** if Python is missing.
   * **Install managed Digilent WaveForms runtime?** if WaveForms isn't installed. The prompt shows where Inlay will install it. Inlay can install the runtime on macOS, Linux (x64 and Arm64), and Windows x64.
   * **Create Inlay Python environment?** and the Python package install that follows.
4. Ask Inlay to list the selected device's digital inputs, analog inputs, waveform outputs, and supplies before you use them.

You don't need to install WaveForms yourself. On macOS, Inlay uses an existing WaveForms installation in `/Applications` when it finds one. If Python 3 is already installed and a Digilent device is connected when Inlay starts, Inlay may set up the runtime in the background, so you might not see every prompt.

### Channel numbers

Inlay counts channels from 0. On the AD3, digital channels are 0 to 15. Analog input 0 is the physical Channel 1, and analog input 1 is Channel 2.

When several Digilent devices are connected, give Inlay the serial number of the one to use.

## Capture digital traffic

```text theme={"theme":"css-variables"}
Use the Digilent analyzer to capture I2C on channels 0 and 1 for two seconds.
Decode it and show the bytes in the Logic tab.
```

| Capture | Use it when | Limit |
| - | - | - |
| Timed | The test has a fixed length | The duration you set |
| Manual | The operation's length varies | Up to 60 seconds; high sample rates reach the capture-size limit sooner |

Stop a manual capture before decoding or saving it. The AD3 uses a fixed digital threshold.

### Add a trigger

Without a trigger, the capture starts immediately. To start on an event, describe one of these:

| Trigger | Provide |
| - | - |
| Edge | Digital channel and `rising` or `falling` edge |
| Level | Digital channel and the required `high` or `low` state |
| External | Trigger input, such as `t1` or `t2`, and `rising`, `falling`, or `either` edge |

```text theme={"theme":"css-variables"}
Use Digilent. Trigger on digital channel 4 rising and capture UART on channel 0
at 230400 baud, 8 data bits, no parity, and one stop bit.
```

In a [hardware script](/docs/debug-mode/hardware-scripts.md), call `la_setup_trigger()` before you start the capture. Use the reported sample rate when you measure timing.

### Capture from the Monitor

You can also capture digital channels from the Monitor's **Logic** tab without asking Inlay.

1. In the Monitor, select **+**, then select the device under **On the bench**. Or open **Logic Analyzer** under **Views** and choose the device from the device chip.
2. If the toolbar shows **Set up & connect** or **Connect**, select it. Selecting **Set up & connect** approves setup.
3. Select the **Logic setup** chip, the settings summary next to the device chip, to open the **Logic analyzer setup** panel.
4. Under **Channels**, choose the channels. Under **Acquisition**, set the **Sample rate**, the **Duration** (up to 60 seconds), and, on a Digital Discovery, the **Threshold**. If the tab reports that the capture exceeds the analyzer's buffer, lower the sample rate or the duration.
5. Under **Trigger**, keep **Immediate**, or choose **Edge** and set the **Channel** and **Edge**. With an edge trigger, **Duration** becomes **After trigger**, the time captured after the edge.
6. Select **Single** to capture once, or **Run** to capture repeatedly until you select **Stop**.

Each capture's raw transitions open in the waveform view and in **Capture history**. To zoom, pan, or jump to a sample range, see [Navigate the waveform](/docs/debug-mode/logic-analyzer.md#navigate-the-waveform). For level or external triggers, decoding, or analog inputs, ask Inlay.

**Disconnect**, **Rename device**, and **Rescan devices** are in the **⋯** (**Device actions**) menu, with **Forget device** for a saved device that isn't currently detected.

## Decode and save

Inlay decodes Digilent captures with these built-in decoders:

| Protocol | Channel roles in scripts | Settings and defaults |
| - | - | - |
| UART | `input` | Baud rate (115200), data bits (8), parity (none), stop bits (1) |
| SPI | `clock`, `miso`; optional `mosi`, `enable` (chip select) | Bits per transfer (8) |
| I2C | `sda`, `scl` | Address display format |
| CAN | `input` | Bit rate (500 kbit/s) |
| LIN | `input` | Bit rate (19200), LIN version |
| 1-Wire | `input` | None |
| Manchester | `input` | Bit rate (1 Mbit/s), bits per frame (8), edge polarity |
| JTAG | `tck`, `tms`; optional `tdi`, `tdo` | None |
| SWD | `swclk`, `swdio` | None |
| Modbus | `input` | Bit rate (19200), data bits (8), parity (even), stop bits (1) |
| I2S / PCM | `clock`, `frame`, `data` | Bits per sample (16) |

The SPI decoder samples on the rising clock edge, most significant bit first, with an active-low chip select. For other SPI modes, use a [DSLogic](/docs/debug-mode/dslogic.md#decode-a-bus) or decode the raw CSV.

Ask for the files you need, then inspect the signals and frames in the **Logic** tab:

* Raw digital CSV, one column per channel.
* A decoded CSV for each decoder, with data in hexadecimal.
* A saved capture as `.dwf3.json`. This is Inlay's Digilent capture format; Logic 2 can't open it.

Exporting raw or decoded CSV sends the capture to the **Logic** tab. In scripts, use `la_add_protocol_analyzer()`, `la_export_raw()`, `la_export_table()`, and `la_save_capture()`.

CAN decoding shows frames. To interpret application-level signals with your project's database, use [CAN Monitor](/docs/debug-mode/can.md).

## Measure analog signals

```text theme={"theme":"css-variables"}
Record the startup rails on analog inputs 0 and 1 for 50 ms at 1 MS/s.
Use a range that contains both signals and report the achieved sample rate.
```

Analog recordings start at once; there is no analog trigger. They appear in the Monitor's **Oscilloscope** tab. Digital captures appear in **Logic**, and supply readings in **Power**.

In a saved script:

```python theme={"theme":"css-variables"}
capture = la_record_analog(
    channels=[0, 1],
    duration_seconds=0.050,
    sample_rate=1_000_000,
    range_volts=5.0,
    channel_names=["vout_v", "vin_v"],
    name="startup rails",
)
```

`range_volts=5.0` asks for a window of at least ±5 V; Inlay picks the smallest device range that covers it. Check the returned rate and duration before you calculate timing.

## Generate a stimulus

Describe the output, waveform, frequency, amplitude, offset, and what happens when the test ends:

```text theme={"theme":"css-variables"}
Generate a 1 kHz square wave on output 0 within the connected input's voltage
limits, capture the response, and stop the output when the test finishes.
```

| Waveform | Notes |
| - | - |
| `sine`, `square`, `triangle`, `ramp-up`, `ramp-down`, `trapezium`, `sine-power`, `pulse`, `noise` | Set frequency, amplitude, offset, symmetry, and phase |
| `dc` | Fixed level from -5 V to 5 V |
| `custom` | Your own samples, scaled from -1 to 1 |

Support for each waveform depends on the device. Amplitude is the peak value, so a 1 V amplitude swings 2 V peak to peak before offset. Amplitude can be up to 5 V and offset from -5 V to 5 V.

In a script, `la_wavegen_setup()` configures an output, and `la_wavegen_start()` and `la_wavegen_stop()` control it. `la_wavegen_dc()` starts a DC level, and `la_wavegen_pulse()` starts a square wave with the duty cycle you choose, each in one call.

Put the stimulus, capture, and cleanup in one script. State the permitted voltage range and the final output state, and stop the output even if the capture fails.

## Control a supply

On a device with adjustable supplies, specify the rail and voltage. The AD3 has a positive rail from 0 to +5 V and a negative rail from 0 to -5 V.

> [!WARNING]
>
> Before enabling a supply or waveform output, check voltage, polarity, grounding, current demand, and any other power source connected to the target.

Ask for an explicit shutdown state. You can read the supply status once or monitor it for a set time:

```text theme={"theme":"css-variables"}
On the AD3, enable the positive supply at 3.3 V, wait 300 ms, then monitor
its reported voltage and current for five seconds. Show the result in Power
and disable the supply afterward.
```

The status includes each rail's voltage and current and the device's USB voltage and current.

In a script, `la_psu_setup()` sets the rails and the master enable, `la_psu_status()` reads them once, and `la_psu_monitor()` records them to the **Power** tab for a set time. Pass `0` for a rail to turn it off.

These readings come from the device's own supply monitor. For an inline current measurement of the target, use a [PPK2](/docs/debug-mode/ppk2.md) or [Joulescope](/docs/debug-mode/joulescope.md).

## Troubleshoot

* **"No Digilent device detected":** check the USB cable and port, then connect an Analog Discovery or Digital Discovery and retry. On Linux, Inlay finds the device with `lsusb`; install your distribution's `usbutils` package if that command is missing.
* **"Managed Digilent WaveForms runtime is not available for host …":** Inlay can't install the runtime on this operating system or processor. Install WaveForms from Digilent, then ask Inlay to check the device again.
* **"Connected Digilent devices do not expose a logic-analyzer instrument":** Inlay can't use this model. Connect a device with digital inputs.
* **Instrument missing:** the selected model doesn't provide that instrument, such as analog inputs on a Digital Discovery.
* **Device busy:** close WaveForms or another script using the device.
* **Clipped analog signal:** increase `range_volts` or reduce the stimulus amplitude.
* **Wrong channel:** compare script indexes, which start at 0, with the physical labels.
* **Analog recording isn't in the Logic tab:** this is expected. Digilent analog recordings open in **Oscilloscope**, and supply readings in **Power**.

See [Logic analyzer](/docs/debug-mode/logic-analyzer.md) to compare instruments.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.