The AVR128DA48 is one of Microchip's AVR DA parts: 128 KB of flash, 16 KB of SRAM and 512 bytes of EEPROM, in a 48-pin package. Like the tinyAVR parts, it is programmed over UPDI, Microchip's one-wire programming interface, and it needs no reset line or high voltage to get there.
A BenchPod programs it with the same pin programmer it uses for a tinyAVR. The UPDI basics are shared, and Programming the ATtiny1607 over UPDI covers them: the half-duplex 8E2 link, SYNC and BREAK, the instruction set, the control/status registers and the NVMProg key. This article covers what AVR DA, DB and DD do differently, and what we measured. It 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.
What is the same
- The link. One pin, a half-duplex UART at 8E2, 115200 baud by default, with a double BREAK (one
0x00frame at 300 baud each) to reset UPDI's state. - The entry. The
NVMProgkey, a reset toggle throughASI_RESET, and a poll ofASI_SYS_STATUSuntilNVMPROGis set andLOCKSTATUSis clear. A locked chip is unlocked only by a chip erase with theNVMErasekey, and only when the job asks for one. - The reads.
REPEATplusLD *ptr++reads a block at a time, and the pod compares every byte with the image. - The job. The pod reads the signature at
0x1100and checks it before it erases anything, erases, writes, reads back, and starts the program at the end.
What is different on AVR DA, DB and DD
The SIB says which NVM controller the chip has. Bytes 8 to 10 of the System Information Block read P:0 on tinyAVR 0/1/2 and megaAVR 0, and `P:2` on AVR DA, DB and DD. The pod takes the address size, the flash location and the command set from that version.
24-bit addresses. NVM version 2 chips have more flash than fits in a 16-bit address, so UPDI uses 24-bit addresses for LDS, STS and the pointer. Flash is mapped into the data space at `0x800000`; the other memories stay below 0x2000, at different addresses from a tinyAVR:
| Memory | ATtiny1607 (NVM v0) | AVR128DA48 (NVM v2) | Hex file address |
|---|---|---|---|
| Fuses | 0x1280 | 0x1050 | 0x820000 |
| User row | 0x1300 | 0x1080 | 0x850000 |
| Signature row | 0x1100 | 0x1100 | |
| EEPROM | 0x1400 | 0x1400 | 0x810000 |
| Flash | 0x8000 | 0x800000 | 0x000000 |
The AVR128DA48's signature is `1E 97 08`. The hex file addresses are the ones avr-gcc uses for both families, so the image needs no translation.
No page buffer. On a tinyAVR the NVM controller has a page buffer: the programmer clears it, fills it with ordinary stores and writes the whole page with one command. NVM version 2 has none. After the Flash Write command (FLWR, 0x02) every 16-bit word stored into the flash range goes straight into flash. The NVM controller's command set is different too:
| Command | Code | Use |
|---|---|---|
NOCMD | 0x00 | Clear the current command (needed before a new one) |
FLWR | 0x02 | Flash write: each word stored is written |
FLPER | 0x08 | Flash page erase: a store into the page starts it |
EEERWR | 0x13 | EEPROM erase and write: each byte stored is written |
CHER | 0x20 | Chip erase |
Every flash word is acknowledged. On a tinyAVR the pod streams a page's words with acknowledgments off (RSD in CTRLA), so the stores run at line speed into the page buffer. On NVM version 2 a word that arrives while the previous one is still being written is lost, and the UPDI link falls out of step. The pod therefore leaves acknowledgments on for flash: the chip answers each word once it is written, and the next word follows the answer. Flash pages are 512 bytes. With erase="page", each page is erased first with FLPER and one dummy store into the page.
EEPROM and fuses, one byte at a time. Both use EEERWR, one acknowledged store per byte. An EEPROM byte takes about 10 ms. The pod ends every write with NOCMD.
Getting back in after a held reset
A job that does not start the program at the end leaves the chip in programming mode, and also held in reset. That is the normal state between two regions: the SDK writes flash first and EEPROM second, as two jobs, and only the last one starts the program. A failed job leaves the chip in the same state. ASI_SYS_STATUS then reads 0x28: NVMPROG and RSTSYS both set.
Two things make this state awkward on the AVR DA:
- The memory does not answer while the chip is held in reset. Seeing
NVMPROGalready set and going straight to the signature read, as works on a tinyAVR, ends in a timeout. - Releasing the reset also ends programming mode. After
ASI_RESET = 0x00,NVMPROGclears.
So when the pod finds RSTSYS set on entry, it releases the reset, waits 2 ms, reads ASI_SYS_STATUS again and, with NVMPROG gone, takes the normal key path: the NVMProg key, a reset toggle, and the poll.
Wiring an AVR128DA48 Curiosity Nano
With the Nano's USB cable unplugged its on-board debugger is off, and the target's UPDI line is on the edge pin labeled DBG0. One signal wire and ground, plus the supply:
| Pod (J1) | Curiosity Nano | Signal |
|---|---|---|
| LA3 | DBG0 | UPDI |
| GND | GND | ground |
| pin 17, +3V3 | VTG | target supply |
No reset line is needed: UPDI resets the chip itself. The board's LED0 is on PC6. Name the LA pin UPDI in the pod's wiring profile and every tool finds it; otherwise pass it as data.
Bench results
We ran the AVR128DA48 Curiosity Nano at 3.3 V with the wiring above:
- The SDK identified the chip from its signature,
1E 97 08, without a device name. - A full test image, 128 KB of random flash data plus 64 bytes of EEPROM, was written and verified in 48 s, 46.7 s of it for the flash.
- A blink program, 512 bytes, was written and verified in 0.9 s. The chip then ran it and the LED blinked.
Things to know
Flash writes are paced by the chip. With one acknowledgment per word, a full 128 KB image is 65536 round trips on the UPDI line, which is why it takes longer per byte than a streamed tinyAVR page. Write only what the image contains.
Do not let a random test image run. A stress test with random flash data is a fine way to check a programmer, but random code running on the chip can drive its pins in any direction. End such a job with the chip held in reset (reset=False in the SDK) and write a real program afterwards.
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 signature: a wiring check, nothing is written.
print(bp.flash(target="avr-updi", data=3, dry_run=True).stdout)
r = bp.flash(target="avr-updi", device="AVR128DA48", data=3, file="blink.hex")
assert r.ok, r.stderrdevice is optional: without it the SDK identifies the chip from its signature. A .hex from avr-gcc that carries EEPROM, fuses or a user row gets all of them written, each as its own job. From the command line, benchpod flash --target avr-updi --device AVR128DA48 --data 3 --file blink.hex; from an AI agent, the MCP server's flash tool with the same arguments.
Underneath, each region is one JSON command after the image is staged in the pod's memory:
{"cmd":"prog_flash","op":"start","proto":"updi","data":3,"mem":"flash","addr":0,"len":512,
"page":512,"erase":"chip","expect_id":"1e9708","flash_base":8388608,"run":true}flash_base is the flash base address in the data space (0x800000), which the SDK takes from its device table. Firmware before 4.0.6 takes the same number as flags. The full reference is in the API docs.
AVR DA, DB and DD programming works on real chips from the firmware release after 4.0.4, with the pin-programmer image installed with benchpod install-blobs. Every chip and method we have verified on real hardware is in How the BenchPod flashes microcontrollers.