Pin programmers: AVR, PIC, EFM8, ATtiny, XMEGA and MSP430
Flash small microcontrollers over their own programming pins, with no separate programmer. The pod runs the chip's protocol on its LA pins.
Six families
| Target | Chips | Wires |
|---|---|---|
avr-updi | AVR with UPDI | 1 (see below) |
pic | PIC with low-voltage entry | 3 (see below) |
efm8 | Silicon Labs EFM8 and C8051F | 2 (see below) |
attiny-tpi | AVR with TPI (ATtiny4 to ATtiny104) | 3 (see below) |
xmega | AVR XMEGA with PDI | 2 (see below) |
msp430 | MSP430 with Spy-Bi-Wire | 4 (see below) |
Every family uses LA channels from 1 to 14 (see the pin-out) and the I/O voltage of the wiring profile, 1.8 or 3.3 V. Connect the ground of the chip's board to the pod's ground. The target needs its own power, or the pod's target power rail.
How to flash
The file is an Intel HEX file, or a raw .bin written at a load address (0 unless you set it). Turn an ELF into HEX with objcopy -O ihex. One call writes one memory: flash by default, or the EEPROM, the configuration (AVR fuses, PIC configuration words, the C2 lock byte) or the user row. Every page is read back and compared.
CLI
--target picks the family. --clk and --data are the LA pins, --reset the reset line of PIC and TPI (Spy-Bi-Wire has none). Without --device the CLI reads the chip's ID and looks the chip up. --info reads the ID and writes nothing.
benchpod flash --target avr-updi --info --data 5 benchpod flash --target avr-updi --device attiny1614 --data 5 --file build/app.hex
Pins you leave out come from the wiring profile, from signals named like the chip's pins (for example UPDI, C2CK, MCLR).
SDK
from embeddedci.benchpod import BenchPod
with BenchPod("embeddedci:my-pod", la_voltage=3.3) as bp:
# The pins come from the wiring profile's signals (UPDI, ICSPCLK, C2CK, ...).
bp.flash(file="build/app.hex", target="avr-updi")MCP server
The flash tool takes the same target names and the pins (or reads them from the wiring profile):
flash(file="build/app.hex", target="pic", clk=3, data=4, reset="nrst")
The target names are avr-updi, pic, efm8, attiny-tpi, xmega and msp430 (4.0.6 and later). The short names updi, c2, tpi, pdi and sbw work too.
AVR with UPDI
Target avr-updi (also updi).
Chips
- tinyAVR 0, 1 and 2 (ATtiny202, ATtiny1614, ATtiny3217 and so on)
- megaAVR 0 (ATmega4809, ATmega808 and so on)
- AVR DA, DB and DD
Wiring
| Chip pin | Pod | Note |
|---|---|---|
UPDI | data | One LA pin. The chip's UPDI pin is also its RESET or GPIO pin, so the pod needs no separate reset wire. |
benchpod flash --target avr-updi --data 5 --file build/app.hex
- The link runs at 115200 baud after entry (`--prog-baud` changes it).
- A UART session on the same pins blocks the flash: close it first.
PIC with low-voltage entry
Target pic.
Chips
- PIC16F1xxx
- PIC16F18xxx
- PIC18F Q series
Wiring
| Chip pin | Pod | Note |
|---|---|---|
ICSPCLK | clk | LA pin |
ICSPDAT | data | LA pin |
MCLR | reset | The pod's own reset pin (default), or an LA pin that the pod drives open drain |
benchpod flash --target pic --clk 3 --data 4 --file build/app.hex
- Only low-voltage entry is supported: the chip must have it enabled (the LVP configuration bit, on by default on most parts) and MCLR must act as MCLR, not as an input pin.
- A chip erase needs VDD above the chip's brown-out level, about 2.7 V on most parts. At 1.8 V the erase can be ignored, so use 3.3 V.
- A chip erase on a PIC18 Q also clears the data EEPROM.
Silicon Labs EFM8 and C8051F
Target efm8 (also c2).
Chips
- EFM8 (Busy Bee, Laser Bee, Sleepy Bee, Universal Bee and others)
- C8051F
Wiring
| Chip pin | Pod | Note |
|---|---|---|
C2CK | clk | LA pin. On most chips this is the RST pin. |
C2D | data | LA pin |
benchpod flash --target efm8 --clk 3 --data 4 --file build/app.hex --erase chip
- The lock byte is written with `--mem config`. A locked chip is unlocked by a chip erase (`--erase chip`), which wipes the flash.
AVR with TPI (ATtiny4 to ATtiny104)
Target attiny-tpi (also tpi).
Chips
- ATtiny102 and ATtiny104 at 3.3 V
- ATtiny4, 5, 9, 10, 20 and 40: not supported (5 V only, see below)
Wiring
| Chip pin | Pod | Note |
|---|---|---|
TPICLK | clk | LA pin |
TPIDATA | data | LA pin |
RESET | reset | The pod's own reset pin (default), or an LA pin that the pod drives open drain |
benchpod flash --target attiny-tpi --device attiny104 --clk 3 --data 4 --file build/app.hex
- The ATtiny4, 5, 9, 10, 20 and 40 can be programmed at 5 V only (their datasheets say 4.75 to 5.5 V). The pod's I/O is 1.8 or 3.3 V, so it cannot program them. Use another programmer for these parts.
- The ATtiny102 and 104 datasheet contradicts itself on the voltage (1.8 to 5.5 V in one place, 5 V in another). Try it at 3.3 V; if the chip does not answer, it needs 5 V.
- These chips erase flash only as a whole code section, so the default erase is a chip erase.
AVR XMEGA with PDI
Target xmega (also pdi).
Chips
- AVR XMEGA (A, B, C, D, E series)
Wiring
| Chip pin | Pod | Note |
|---|---|---|
PDI_CLK | clk | LA pin. It is the chip's RESET pin. |
PDI_DATA | data | LA pin |
benchpod flash --target xmega --clk 3 --data 4 --file build/app.hex
- 3.3 V is fine. At 1.8 V it works only when the chip's BODLEVEL is below VCC.
- The chip may run its program for a moment when the programming interface times out between two steps of a job.
MSP430 with Spy-Bi-Wire
Target msp430 (also sbw).
Chips
- TI MSP430FR2xx FRAM parts (MSP430FR2433 tested on the bench)
Wiring
| Chip pin | Pod | Note |
|---|---|---|
TEST | clk | LA pin (Spy-Bi-Wire clock, SBWTCK) |
RST | data | LA pin (Spy-Bi-Wire data, SBWTDIO). The pod needs no separate reset wire. |
GND | ground | Ground of the chip's board to the pod's ground |
VCC | 3.3 V | The chip's supply: its own, or the pod's 3.3 V target power rail |
benchpod flash --target msp430 --clk 3 --data 4 --file build/app.hex
- Needs BenchPod release 4.0.6 or later (firmware, SDK, MCP and CLI). In the SDK the target is "msp430" (the name "sbw" works too).
- Flash and the information memory are written and read back. A 16 KB image takes about a minute, because Spy-Bi-Wire moves one word at a time.
- A chip that is JTAG-locked answers with its JTAG ID only, so name it (--device MSP430FR2433) and erase it (--erase chip, the default). The erase wipes the chip, including the lock.
- Without a wiring profile, pass --clk and --data. A profile can name the signals SBWTCK (or TEST) and SBWTDIO (or RST) instead.
Results and what to do
A job ends with ok or one of these messages. Tools show the message together with the step it failed in (enter, erase, write or leave).
| Message | Meaning | What to do |
|---|---|---|
| no answer (wiring, power or I/O voltage) | The chip did not answer in programming mode. | Check the pins, that the target is powered, and that the wiring profile's I/O voltage matches the chip. For PIC, check that low-voltage entry is enabled. For TPI, try 3.3 V and see the ATtiny notes. |
| wrong chip (the ID is not expect_id) | The chip's ID is not the one you named, so the pod stopped before it erased anything. | Check --device (or the device your tool found). Use --info to read the ID. Skip the check only when you are sure (--no-expect-id). |
| locked (erase the chip to unlock it) | Code protection blocks reading and writing. | Flash again with the erase set to chip. That wipes the flash and unlocks the chip. |
| verify failed | A page read back differently from what was written (the result gives the address). | Retry. If it repeats at the same address, check the supply voltage and wiring length, and that the chip's flash is not worn. |
| timeout (the chip stayed busy) | An erase or write did not finish in time. | Check the supply voltage. A PIC erase below its brown-out level can hang; use 3.3 V. |
| protocol error (an answer the protocol does not allow) | The chip answered, but not as the protocol says. | Usually noise or a wrong chip family. Shorten the wires and check the target name. |
| memory, address, length or page size not valid here | The memory, address or image size does not fit this chip. | Check the memory (flash, eeprom, config, user), the load address, and that the image fits. |
| not supported (this chip, memory or protocol) | The firmware does not do this for this chip. | Use another memory, or another programmer for this chip. |
| aborted | The job was stopped. | Start it again. The chip may hold a partly written image until you do. |
Other refusals: nothing staged means the image did not reach the pod (the tools do this for you); a busy pod (BP0047) is running a capture or another flash; BP0031 is a pin another feature owns (release it first); and a refusal that says to install the blobs means benchpod install-blobs. See error codes.
Requirements
- Firmware with pin programming and the
xip_progblob installed. The blob also runs the USB flash protocols' code, so a USB flash cannot start while a pin flash runs, and the other way round. - Not at the same time as a capture, SWD, SPI or I2C session. They share the pod's engine; the pod answers busy.
- Not on the emulation image (gateware v65 and later). The two-wire programmers (PIC, C2, TPI, PDI, Spy-Bi-Wire) are not in the emulation image. A start there answers
BP0058, orBP0059while sensors run. UPDI works in every image. - The pod's network, USB network or embeddedci.com. The serial console does not carry the image.