Back to resources
Chip programming
Firmware
HIL

Programming the ATtiny1607 over UPDI with a BenchPod

How the BenchPod flashes an ATtiny1607 over its one-wire UPDI pin with no programmer attached: the UPDI protocol step by step, the NVM controller, the wiring on a Curiosity Nano, measured results and the protocol details every UPDI programmer has to get right.

Edward Viaene · November 24, 2026 · 12 min read

The ATtiny1607 is a tinyAVR 0-series part: 16 KB of flash, 1 KB of SRAM, 256 bytes of EEPROM, in a 24-pin package. It has no SWD port and no bootloader from the factory. The only way in is UPDI, Microchip's one-wire programming and debug interface. Normally that means a dedicated programmer, or a USB-serial adapter with a resistor and pymcuprog.

A BenchPod can do it without either. The pod runs the chip's programming protocol itself, on one of its logic analyzer pins, as one of its pin programmers. This article is part of a series, one per chip we have run on real hardware: the overview of how the BenchPod flashes microcontrollers lists them all. It covers how UPDI works, how the pod implements it, how to wire an ATtiny1607 Curiosity Nano, what we measured, and the protocol details that trip up programmers.

UPDI in one paragraph

UPDI (Unified Program and Debug Interface) is a half-duplex UART on a single pin. Host and chip take turns on the same wire, which idles high through a pull-up. Frames are 8 data bits, even parity and 2 stop bits (8E2). There is no fixed baud rate: every instruction starts with a SYNC character, 0x55, and the chip measures its alternating bits to lock onto whatever rate the host uses. The pod runs the link at up to 225000 baud, 115200 by default.

The chip only ever speaks when asked, so the protocol is a strict request and reply: the host sends an instruction, the chip answers with data or an ACK (0x40), or nothing at all.

A UPDI frame: start bit, 8 data bits LSB first, even parity, 2 stop bits. The SYNC character 0x55 gives the chip alternating edges to time the baud rate.
A UPDI frame: start bit, 8 data bits LSB first, even parity, 2 stop bits. The SYNC character 0x55 gives the chip alternating edges to time the baud rate.

The instruction set the pod uses

UPDI has a small instruction set. Every instruction is one byte after the SYNC, with the operand size and address size folded into its low bits.

InstructionOpcodeWhat it does
LDCS0x80 \regRead a UPDI control/status register
STCS0xC0 \regWrite a UPDI control/status register
LDS / STS0x00 / 0x40 \sizeRead or write one byte at a data-space address
ST ptr0x68 \sizeSet the pointer register
LD *ptr++0x24Read through the pointer, then increment it
ST *ptr++0x64 / 0x65Write a byte or a 16-bit word through the pointer
REPEAT0xA0Repeat the next instruction n + 1 times
KEY0xE0Send an 8-byte key
KEY (SIB)0xE5Read the 16-byte System Information Block

REPEAT plus LD *ptr++ is how a whole page is read in one go: 5 bytes on the wire (55 A0 3F 55 24), then 64 bytes back.

The control/status (CS) registers that matter for programming:

RegisterAddressRole
STATUSA0x00UPDI revision; nonzero once the link is up
CTRLA0x02Inter-byte delay, guard time, and RSD (response signature disable: no ACK per store)
CTRLB0x03CCDETDIS (ignore contention) and UPDIDIS (switch UPDI off)
ASI_KEY_STATUS0x07Which key the chip accepted (NVMPROG bit 4, CHIPERASE bit 3)
ASI_RESET0x08Write 0x59 to hold the core in reset, 0x00 to release it
ASI_SYS_STATUS0x0BLOCKSTATUS (bit 0), NVMPROG (bit 3) and others

From an idle pin to programming mode

Getting a tinyAVR from "running its program" to "ready to have its flash written" takes six steps. This is the order the pod runs them in.

The entry sequence between the pod and the ATtiny1607, from the enable pulse to reading the signature 1E 94 23
The entry sequence between the pod and the ATtiny1607, from the enable pulse to reading the signature 1E 94 23
  1. Enable pulse. The host pulls the line low briefly (one 0x00 frame at the link rate). The chip answers by holding the line low until its UPDI clock runs. The first SYNC must then start between 200 µs and 14 ms after the line is released, or UPDI switches itself off again. The pod waits 500 µs.
  2. Link setup. STCS CTRLB = CCDETDIS, STCS CTRLA = 0x86 (inter-byte delay on, guard time of 2 cycles), then LDCS STATUSA. A nonzero answer means the link works. If it does not, the pod sends two BREAKs and tries again. A BREAK is the line held low for longer than any frame at the slowest rate; the pod sends one 0x00 at 300 baud, about 33 ms low. Two in a row reset UPDI's state machine whatever it was doing.
  3. SIB. The 16-byte System Information Block is ASCII. It names the family (tinyAVR), and bytes 8 to 10 read P:0 or P:2: the NVM controller version. The ATtiny1607 reports P:0, which tells the pod to use 16-bit addresses, flash mapped at 0x8000, and the version 0 command set.
  4. NVMProg key. The pod requests a reset (ASI_RESET = 0x59), sends the key NVMProg (8 bytes, last byte first), and checks ASI_KEY_STATUS bit 4.
  5. Reset toggle. ASI_RESET = 0x59, then 0x00. The key only takes effect through a reset.
  6. Poll. ASI_SYS_STATUS until NVMPROG is set and LOCKSTATUS is clear, within 100 ms. Then the pod reads the 3-byte signature at 0x1100. For the ATtiny1607 that is `1E 94 23`.

If LOCKSTATUS stays set, the chip is locked. The only way in is a chip erase: the NVMErase key, another reset toggle, and a wait until the lock clears. The pod does that only when asked to erase the whole chip, so a locked chip is never wiped by surprise.

Writing flash through the NVM controller

Once in programming mode, flash is just memory. On tinyAVR 0/1/2 it sits in the data space at 0x8000, EEPROM at 0x1400, fuses at 0x1280 and the user row at 0x1300. Writes go through the NVM controller at 0x1000: you fill its page buffer with ordinary stores, then give it a command.

CommandCodeUse
WP0x01Write page buffer to flash
ERWP0x03Erase the page, then write it
PBC0x04Clear the page buffer
CHER0x05Erase the whole chip
WFU0x07Write one fuse byte

The ATtiny1607 has 64-byte flash pages. For each page the pod:

Writing one 64-byte flash page: wait, clear the page buffer, stream the words, write, wait, read back and compare
Writing one 64-byte flash page: wait, clear the page buffer, stream the words, write, wait, read back and compare
  1. waits until the controller's STATUS busy bits clear,
  2. sends PBC,
  3. sets the pointer to the page and streams 32 word stores (REPEAT 31, ST *ptr++ word) with RSD on, so the chip sends no ACK per word and the stream runs at line speed,
  4. sends WP (after a chip erase) or ERWP (page erase),
  5. waits for busy to clear and checks the write-error bit,
  6. reads the page back with REPEAT + LD *ptr++ and compares it byte for byte with the image.

EEPROM, fuse and user-row bytes are written with ACKs on instead, because each byte waits for the chip's write. Fuses go one byte at a time through the controller's ADDR and DATA registers and WFU.

Leaving programming mode

When the last region is written, the chip has to be let go so it runs its new program:

  1. ASI_RESET = 0x59 holds the core in reset, then a pause of about 1 ms.
  2. ASI_RESET = 0x00 releases it. The chip leaves NVM programming mode as it comes out of reset.
  3. The pod polls ASI_SYS_STATUS until NVMPROG clears (at most 50 ms).
  4. STCS CTRLB = UPDIDIS switches UPDI off, and the program runs.

Step 3 looks optional. It is not (see "Things to know" below).

How the pod runs it

Who does what: the host prepares the image, the pod's MCU runs UPDI, the FPGA drives one half-duplex wire to the chip
Who does what: the host prepares the image, the pod's MCU runs UPDI, the FPGA drives one half-duplex wire to the chip

The work is split three ways:

  • The host (the Python SDK, the CLI or the MCP server) reads the .hex, .elf or .bin, asks the pod for the chip's ID, looks the ID up in its device table, and cuts the image into the chip's memories: flash, EEPROM, fuses and user row, at the addresses avr-gcc puts them (0x810000 for EEPROM, 0x820000 for fuses, 0x850000 for the user row). It uploads each region into the pod's memory and starts one job per region.
  • The pod's MCU runs the UPDI protocol described above as a small state machine: the entry sequence, the erase, and the write-then-verify loop for every page. The job runs in the background and the host polls its progress. Because the protocol runs next to the pin, nothing about it depends on network latency: the same job takes the same time over the LAN, USB or the cloud.
  • The FPGA provides a soft UART on any of the 14 LA pins, in half-duplex open-drain mode with a pull-up, at the target's I/O voltage (1.8 or 3.3 V). Its receiver ignores the line while the pod is transmitting. That detail matters: a USB-serial adapter with TX and RX tied together hears every byte it sends, and software like pymcuprog reads and drops that echo. The pod hears only the chip.

The pod holds no device tables. It reports the ID bytes and checks them against the expect_id the host sends, before it erases anything. If a different chip answers, the job stops with wrong chip and the flash is untouched.

Wiring an ATtiny1607 Curiosity Nano

The ATtiny1607 Curiosity Nano has an on-board debugger. With its USB cable unplugged that debugger is unpowered, and the target's UPDI line is available on the edge pin labeled DBG0. Three wires are enough:

Pod (J1)Curiosity NanoSignal
LA1DBG0UPDI
pin 15, GNDGNDground
pin 17, +3V3VTGtarget supply
Three wires from the pod's J1 header to the Curiosity Nano: LA1 to DBG0, GND to GND, +3V3 to VTG, with the Nano's USB unplugged
Three wires from the pod's J1 header to the Curiosity Nano: LA1 to DBG0, GND to GND, +3V3 to VTG, with the Nano's USB unplugged

Leave the Nano's USB unplugged, so the pod is the only thing powering and driving the board. The Nano's header holes are staggered slightly, so a straight pin header pressed into them holds by friction: no soldering needed for a quick test.

Name the LA pin UPDI in the pod's wiring profile and every tool finds it without a pin argument; otherwise pass it as data.

Bench results

We ran the ATtiny1607 Curiosity Nano at 3.3 V with the wiring above:

  • The ID 1E 94 23 read back every time, repeatedly, at 32000, 57600, 115200 and 225000 baud.
  • A 64-byte program and a full 16 KB image were written and verified. The 16 KB write, including reading back every page, took 6.9 s.
  • After the job, the chip runs its new program: a blink program flashed this way blinks the board's LED.

The default link rate is 115200 baud.

Things to know about UPDI

A few properties of the protocol matter for any UPDI programmer, not just the pod.

The line is half duplex. Host and chip share one wire, so a programmer built from a USB-serial adapter with TX and RX tied together hears every byte it sends and has to read and drop that echo before the reply. The pod's receiver ignores the line while the pod transmits, so it never sees an echo and reads only the chip's reply. Either way, clear anything still waiting before each request: the chip never speaks unasked, so a leftover byte is a late reply that would shift every reply after it.

A chip already in programming mode ignores the NVMProg key. If an earlier session ended without letting the chip go (a failed job, a cable pulled mid-write), the chip is still in NVM programming mode. Sending NVMProg again does nothing and ASI_KEY_STATUS reads 0x00. Read ASI_SYS_STATUS first: when NVMPROG is already set, skip the key and go straight to the status poll.

Give the chip time to leave programming mode. After the reset release, the chip needs a moment to drop out of NVM programming mode. Writing UPDIDIS right away leaves it in programming mode (ASI_SYS_STATUS reads 0x08) with the CPU stopped: every page verified, but the program never runs. Wait for NVMPROG to clear first, as in the exit sequence above. A USB-serial adapter gets this delay for free from its latency; a fast programmer has to wait on purpose.

You can read a running chip. After a double BREAK, LDS reads the live I/O registers of a running chip without the NVMProg key and without resetting it. It is a handy way to check that a program really runs: on a blink program, PORTB.DIR reads 0xFF once the program has set up its LED pin, and ASI_SYS_STATUS no longer shows NVMPROG.

Using it

From Python, with the pytest package:

from embeddedci.benchpod import BenchPod

with BenchPod("192.168.1.50", la_voltage=3.3) as bp:
    # Only enter programming mode and read the ID: a wiring check, nothing is written.
    print(bp.flash(target="avr-updi", data=1, dry_run=True).stdout)

    r = bp.flash(target="avr-updi", device="attiny1607", file="app.hex", data=1)
    assert r.ok, r.stderr

device is optional: without it the SDK identifies the chip from its ID. With it, a different chip on the pins is an error before anything is erased. erase is "chip" by default (which also unlocks a locked chip), "page" erases only the pages written. A .hex from avr-gcc that carries EEPROM, fuses or a user row gets all of them written, flash first and fuses last.

From the command line:

benchpod flash --target avr-updi --data 1 --info
benchpod flash --target avr-updi --device ATtiny1607 --data 1 --file app.hex

From an AI agent, the MCP server's flash tool takes the same arguments: flash(target="avr-updi", device="ATtiny1607", data=1, file="app.hex"), and dry_run=true to read the ID first.

Underneath all three is one JSON command. Stage the region with load_bin into the pod's memory, then:

{"cmd":"prog_flash","op":"start","proto":"updi","data":1,"mem":"flash","addr":0,"len":16384,
 "page":64,"erase":"chip","expect_id":"1e9423","flash_base":32768,"run":true}
{"cmd":"prog_flash","op":"status"}

flash_base is the flash base address (0x8000) the SDK takes from its device table (firmware before 4.0.6 takes it as flags), and baud (default 115200) sets the link rate. status reports the phase (enter, erase, write, leave, done), pages done out of the total, the chip's ID and, at the end, ok or a reason with what to check. The full reference is in the API docs.

UPDI works on real chips from the firmware release after 4.0.4, with the pin-programmer image installed with benchpod install-blobs. The same avr-updi target covers the rest of tinyAVR 0/1/2, megaAVR 0 and AVR DA/DB/DD (Programming the AVR128DA48 over UPDI covers what AVR DA, DB and DD do differently); the pin programmers page lists the other protocols. Every chip and method we have verified on real hardware is in How the BenchPod flashes microcontrollers.