Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

UPDIreset

A simple tool (Linux only) to reset a Microchip AVR using UPDI and a cheap modified USB to serial adapter

Licence and Disclaimer

UPDIreset is Copyright (c) 2026 by kittennbfive and released under AGPLv3+ WITHOUT ANY WARRANTY.
Currently this tool was only tested with the Attiny402. Feedback for other AVR welcome (open an issue)!

The problem

I use avrdude and a modified CH340G USB to serial adapter (based on this idea) to programm - currently - an Attiny402. It works great, but because the Attiny402 has no dedicated RESET-pin (it is shared with UPDI and used for the latter by default) there is no way to reset the AVR easely. Avrdude does not offer this functionality (as far as i know) although all the needed code is already there. Power-cycling the Attiny402 works obviously but you have to be very careful about external signals feeding back through the protection diodes of the AVR, so in my case this was not a good option either.

The solution

There is a way to reset an AVR via UPDI by programming a specific register, as detailled in the datasheet of the Attiny402 (and probably other similar AVR). Also avrdude is Open Source (Thanks!), so i carefully read the datasheet, took a sneak peek at the avrdude source (without copying any code!) and wrote this simple tool.

How to compile

Just run gcc -Wall -Wextra -Werror -o updireset main.c.

How to use

You can run the tool without any arguments, it will then use DEFAULT_INTERFACE (set to /dev/ttyUSB0, adjust if you want before compiling).
You can also run the tool and specify the interface as the only argument, like updireset /dev/ttyUSB3.

The other possible way

It should be possible to change a fuse on the Attiny402 to make the RESET-pin working, but then i would need a more complex programmer that can send a 12V pulse to enter UPDI mode. I don't have that and also it is a bit risky: If by accident you wire a 3,3/5V UPDI programmer to the wrong pin of your target nothing too bad should happen, but if this programmer sends a 12V pulse (on the wrong pin) then you may let the magic smoke get out of your AVR...

Limitation

If the UDPI interface of your target AVR is in some weird/invalid state my tool might not work. Indeed, for simplicity, it does not read back anything from the AVR to check for a valid link, it just blindly sends the bytes for reset.
You can either power-cycle the AVR or run avrdude without any specified action (eg avrdude -p attiny402 -c serialupdi -P /dev/ttyUSB0 or similar) that will do some "double break" magic to reset the internal state of the UDPI interface (and reset the AVR too).

About

A simple tool to reset a Microchip AVR using UPDI and a cheap modified USB to serial adapter

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages