Supported hardware

5 V logic and RS-485

This page shows the wiring for both adapters, the UART frame settings (parity and stop bits) and a pytest that reads a Modbus holding register through a transceiver.

The LA pins' limit

LA1 to LA14 swing between 0 V and the I/O voltage you set, 1.8 V or 3.3 V, and that is also the most they take: never connect a signal above the I/O voltage you set, so never more than 3.3 V. A 5 V signal on an LA pin can damage the pod. See Safety and limits for every port.

5 V TTL serial

Put a two-channel level shifter between the pod and a 5 V UART: its low side on the pod (VCC from J1 pin 17, +3V3, with the I/O voltage set to 3.3 V), its high side on the DUT's 5 V. Use a shifter that is fast enough for your baud rate; most are fine up to 115200 baud.

  • DUT TX (5 V) to the high side, low side to the pod's RX pin (LA5 in the examples).
  • Pod TX pin (LA4) to the low side, high side to the DUT's RX.
  • Pod GND (J1 pin 15) to the DUT's GND.
# The pod's side of the shifter at 3.3 V, the DUT's side at 5 V.
# Set the pod's I/O voltage to match the low side first:
benchpod.set_la_voltage(3.3)
with benchpod.open_uart(rx=5, tx=4, baud=9600) as uart:   # through the shifter
    uart.write("version\r\n")
    print(uart.read_until("\n", timeout=1))

A plain resistor divider on the DUT's TX also works for the pod's RX at low baud rates, but the pod's 3.3 V TX may not reach a 5 V input's high level: use the shifter for both directions.

Parity and stop bits

The pod's UART is 8N1 unless you ask for another frame. Some protocols use another one: Modbus RTU, for example, uses 8E1 (8N2 when the device has no parity), always through the adapters above. Every UART surface takes the frame format; it needs pod firmware 3.10.8 or later (gateware v56):

  • SDK: open_uart(..., parity="even", stop_bits=1), also on capture_uart and power_cycle_and_capture. Left out, they come from the pins profile. parity is "none", "even" or "odd"; stop_bits is 1 or 2.
  • MCP: the parity and stop_bits arguments of uart_open, capture_uart and power_cycle_and_capture.
  • Pins profile: uart_parity ("none", "even", "odd") and uart_stop_bits (1, 2), next to uart_baud. In the web app and the desktop app: Parity and Stop bits on a UART pin in Pins, and next to the baud rate in the console.
  • Pod API: uart_proxy_start with "parity" and "stop_bits".

The pod checks the parity bit and the first stop bit of every byte it receives. A byte with a wrong parity bit is still delivered, and the pod's status reports uart_rx_parity_error: true until the next session. Older firmware refuses anything but 8N1 with an error that names the firmware to install.

One-wire UART (half duplex)

Some boards send and answer on a single wire, such as a debug pin or a single-wire bus. Wire it to one LA pin and set that pin as UART RX in the pins profile. The pod only pulls the line low and leaves the high level to a pull-up: it turns the pin's own pull-up on for the session on LA1 to LA6; on other pins, use a pull-up on the board. It does not read back its own bytes, so you only see the board's answers.

  • Web app: tick One wire (half duplex) in the console before connecting.
  • SDK: open_uart(rx=3, tx=3, half_duplex=True), also on capture_uart. MCP: the half_duplex argument of uart_open and capture_uart.
  • Pod API: uart_proxy_start with "half_duplex":true and the same channel in rx and tx.

Boot entry

Some boot ROMs pick their mode from the level of the UART pin when the chip leaves reset, then expect a byte soon after. The pod runs that sequence itself, so no network delay sits between the reset and the first byte:

  1. With TX low through the reset: hold TX low.
  2. Hold the board in reset on the pod's reset pin for Reset ms, then release it.
  3. Wait Hold ms, then release TX: the line idles high.
  4. Wait Idle ms, then send the first bytes (up to 32, in hex).

Each time is 0 to 1000 ms, 10 by default. Your chip's datasheet gives the timing it needs. The board's reset line goes to the pod's reset pin. In the web app, tick Boot entry before connecting in the console; the SDK takes entry=UartEntry(...) on open_uart and capture_uart, the MCP an entry argument, and the pod API an "entry" object on uart_proxy_start.

One wire and boot entry need pod firmware with gateware v57; older firmware refuses them.

RS-485 and Modbus RTU

RS-485 is a differential bus and the pod cannot drive it: put an external half-duplex RS-485 transceiver between the pod and the bus. Use one made for a 3.3 V supply (a 5 V transceiver needs a level shifter on its three logic lines as well). It takes two LA pins for the data and one for the direction (DE and /RE):

PodTransceiverNote
LA5 (pod RX)RO (receiver out)The pod listens here
LA4 (pod TX)DI (driver in)The pod sends here
LA9 (DE)DE and /RE, tied togetherHigh: the pod drives the bus. Low: it listens. The pod switches it itself while it sends (open_uart de=9). Add 10k to GND so the transceiver listens while no session runs
J1 pin 17, +3V3VCCA transceiver made for 3.3 V supplies
J1 pin 15, GNDGNDAlso connect it to the bus ground (the "C" or "0 V" terminal) of the device
(bus)A and BTo the device's A and B (some label them D+ and D-, or swap the names: if nothing answers, swap them)
  • Termination: 120 ohms across A and B at each end of the bus. On a short bench cable with one device, one resistor at the far end is enough.
  • Bias: the bus needs one pull-up on A and one pull-down on B somewhere (often built into the master or the transceiver board), so it idles at a defined level while nobody drives it.
  • Pins: any free LA pins work. Avoid LA1 to LA6 for DE: their pull-ups, when on, would turn the driver on. LA7 and LA8 have a switchable 10k pull-down that can stand in for the external one.
  • Direction: a transceiver board with automatic direction control needs no DE pin. See direction switching for when that helps.

A pytest example: read a holding register

The test sends a Modbus RTU "read holding registers" request (function 3) and checks the reply's CRC. The session uses encoding="latin-1", which keeps every byte as one character, so .encode("latin-1") gives the raw bytes back. It needs the benchpod fixture from the pytest framework.

# test_modbus.py: read a holding register from a Modbus RTU device through an
# RS-485 transceiver on LA4 (DI), LA5 (RO) and LA9 (DE + /RE), 19200 baud, 8E1.
# The pod switches DE itself while it sends (de=9), so the host does nothing for it.
import struct
import time

BAUD = 19200
SLAVE = 1          # the device's Modbus address
REGISTER = 0       # the holding register to read


def crc16(data: bytes) -> bytes:
    """Modbus RTU CRC, low byte first."""
    crc = 0xFFFF
    for b in data:
        crc ^= b
        for _ in range(8):
            crc = (crc >> 1) ^ 0xA001 if crc & 1 else crc >> 1
    return struct.pack("<H", crc)


def read_holding_registers(uart, slave, first, count=1, timeout=1.0):
    request = struct.pack(">BBHH", slave, 0x03, first, count)
    request += crc16(request)
    uart.write(request)                         # DE goes high and low with these bytes
    want = 5 + 2 * count                        # address, function, length, data, CRC
    reply = b""
    deadline = time.monotonic() + timeout
    while len(reply) < want and time.monotonic() < deadline:
        reply += uart.read(timeout=0.05).encode("latin-1")
    assert len(reply) >= want, f"no answer from slave {slave}: {reply.hex()}"
    reply = reply[:want]
    assert crc16(reply[:-2]) == reply[-2:], f"bad CRC: {reply.hex()}"
    assert reply[1] == 0x03, f"exception {reply[2]} from slave {slave}"
    return list(struct.unpack(f">{count}H", reply[3:3 + 2 * count]))


def test_read_holding_register(benchpod):
    with benchpod.open_uart(rx=5, tx=4, de=9, baud=BAUD, parity="even",
                            encoding="latin-1") as uart:
        values = read_holding_registers(uart, SLAVE, REGISTER)
        assert 0 <= values[0] <= 0xFFFF
        assert not benchpod.status().get("uart_rx_parity_error")

On older firmware, switch DE from your computer with a GPIO around each request. Each GPIO call travels over the network, so DE drops about 25 ms after the request ends on a local network (more over the cloud): a device that answers sooner loses the start of its reply. Raise the device's response delay if it has one, or use a transceiver board with automatic direction control, which switches DE by itself from the data and needs no DE pin.

# Firmware without the DE option: switch DE with a GPIO around each request.
de = benchpod.gpio(9, "output", level=0)        # listen until we send
de.high()                                       # drive the bus
uart.write(request)
time.sleep(len(request) * 11 / BAUD + 0.002)    # 11 bits a byte at 8E1
de.low()                                        # release it: the device answers
# ... read the reply as above, then: benchpod.release_gpio(9)