A convenient UPDI programmer with automatic UART / UPDI selection Designed by MCUdude (Hans) in Norway
(you can buy it here: https://www.tindie.com/products/mcudude/serialupdi-programmer)
There are also other approaches to realising a SerialUPDI adapter, like e.g.:
- SerialUPDI-Programmer
- SerialUPDI-HV-Programmer
- tinyUPDI
- UPDI-USB-SERIAL
- Adafruit's new SerialUPDI LV adapter "UPDI Friend" (with USB-C / CH340E / AP2112K) ➔ PCB
- Adafruit's new SerialUPDI HV adapter "High Voltage UPDI Friend"
The MCUdude SerialUPDI programmer is a tiny programmer for use with any AVR that has a UPDI programming interface. It can also be used as a standard USB to serial adapter for easy serial debugging.
I made this board because there doesn't exist a SerialUPDI-based programmer that can automatically switch between UART and UPDI mode. It's also very convenient that the board can supply either 3.3V or 5V to the target. Unlike the microUPDI programmer, this programmer supports the AVR-DA, AVR-DB, and AVR-DD series as well. It's also significantly faster than the microUPDI.
- Versatile programmer that supports all AVRs that can be programmed using UPDI
- Switch between 3.3V and 5V logic, and use a dedicated switch to power the target
- Supported by Avrdude and Pymcuprog for command line programming
- Can be used though Arduino IDE through MegaCoreX, DxCore and megaTinyCore
- Supports UPDI and UART mode
- The tiny, three-way switch on the back of the board lets you select three different modes.
- UPDI - Programmer is always in UPDI programming mode (PROG LED on)
- UART - Programmer is always in UART mode and will send and receive data on the RX and TX pins to the target (PROG LED off)
- AUTO - Programmer will automatically switch between UPDI and UART mode. RTS active (LOW level) -> UPDI mode, RTS inactive (HIGH level) -> UART mode.
When the programmer is set to AUTO, it is the RTS handshake line that determines the mode. This means that the upload tool has to set this to active (low level) in order for the programmer to switch over to UPDI mode. On the other side, the serial monitor program has to set the RTS line to inactive (high level) in order for the programmer to switch over to UART mode. Avrdude and Pymcuprog set the RTS line active when programming, but serial monitors aren't that consistent. If the upload tool or serial monitor doesn't do anything with the RTS line, the RTS line would do whatever the default behavior is, depending on the OS driver.
| SerialUPDI AUTO mode | Windows | MacOS | Linux |
|---|---|---|---|
| Uploading | Works | Works | Works |
| Arduino serial monitor | Works | Works some times | Not yet tested |
| Platformio serial monitor | Works | Works | Works |
When using the SerialUPDI programmer with the PlatformIO serial monitor, please add the following snippet to your platformio.ini file. (I have no idea why their serial monitor, Miniterm, believes the RTS pin actually is DTR, but it works!)
monitor_dtr = 0
Differences between microUPDI and SerialUPDI
| SerialUPDI | microUPDI | |
|---|---|---|
| Supported targets | All AVRs with UPDI | ATtiny and ATmega's with UPDI |
| Fully assembled | Yes * | No (Pro Micro not included) |
| Debug support | No | Yes |
| Programming speed | Fast | Moderate |
| Microchip Studio / MPLAB X support | No | Yes |
| USB to serial/UART | Yes (native) | Yes (emulated, limited baud rate) |
| Target power | 5V / 3.3V / none | 5V / 3.3V / none |
* 6-pin programming connector not soldered
The SerialUPDI programmer is designed to be used with Avrdude 7 or newer, but can also be used with Pymcuprog.
A compatible version of Avrdude is automatically installed when you install MegaCoreX, but you can also compile your own. Pre-built, static binaries for your favorite system can be downloaded from the Arduino Avrdude-packaging repo. For more information om how to use Avrdude, see the official documentation.
In order for the programmer to behave consistently in AUTO mode, the -x rtsdtr=high flag needs to be present.
Write to flash and EEPROM:
avrdude.exe -C /path/to/avrdude.conf -c serialUPDI -P COMx -x rtsdtr=high -U flash:w:my_program.hex:i -U eeprom:w:my_program.eep:i
Read flash and EEPROM, and write the content to flash_content.hex and eeprom.hex:
avrdude.exe -C /path/to/avrdude.conf -c serialUPDI -P COMx -x rtsdtr=high -U flash:r:flash_content.hex:i -U eeprom:r:ee_content.hex:i
Write SYSCFG0 fuse:
avrdude.exe -C /path/to/avrdude.conf -c serialUPDI -P COMx -x rtsdtr=high -U syscfg0:w:0xC9:m
Note that there are a few optional flags you can add:
- Note that the
-C path/to/avrdude.confflag is not needed if the avrdude.conf and avrdude executable are located in the same folder -b [baudrate]sets the upload speed. Defaults to 115200 if not specified-v,-vv,-vvvor-vvvvsets the verbosity level to 1, 2, 3 or 4-qqmutes all output.-tenters terminal mode, where all memories can be read and written to at a byte level





