Yet Another UPDI Programmer.
This is a decription of the design and build of a UPDI programmer of the sort used to program, for example, the tinyAVR series one chips e.g. ATtiny1614 which has the special features that (a) the USB/UART can swap roles between the programming and serial monitor functions and (b) that it can power the project being programmed at 3.3volt or 5volts (switchable). Currently, the role swapping of the UPDI/serial monitor roles of the USB/UART chip is jumper switchable. The next improvement would be an automatic role swapping. The main ideas for this came from @DrAzzy for the serial UPDI stuff and Seeed Studio for the switchable 3.3v/5v USB Uart adapter.
This is a hybrid of an earlier design I published here: ATtiny1614 / USBTTL adapter for UPDI programming and serial console access which itself borrows heavily from the work of Dr Azzy here AVR-Guidance/jtag2updi.md at master · SpenceKonde/AVR-Guidance · GitHub and a Seeed Studio design for a 3.3v/5v USB/UART adapter https://files.seeedstudio.com/wiki/USB_To_Uart_5V_3V3/res/USB_To_Uart_5V_3V3_v1.pdf
It uses a jumper to change the voltage and a jumper and an analog switch to swap the role of the USB/TTL adapter.
I changed the basic Seeed Studio adapter design to use the CH340C chip which is simple to use because it has an inbuilt crystal oscillator. Instead of their DPDT switch, I used a transistor pair and a jumper. There maybe some scope for simplifying this design.
For the pin header design, I used the standard FTDI pinout but used the (normally) unused CTS pin for UPDI and omitted the DTR pin. I guess everyone will invent their own but this works for me.
I did have some problems using the programmer reliably at 3.3volts. These were solved by swapping the original 1n4148 diode in the UPDI path for a Schottky 1n5817. This area, including the associated resistor value, may require experimentation because the 1n4148 appeared to work OK on an earlier and quite similar breadboard design.
Ideal would be an automatic swapping of the role of the USB/UART adapter. The idea of modifying the UPDI-serial Python suite to give a signal on say DTR of that adapter has been talked about. I also did some experiments with a logic analyser and later with a ATmega32U4 to watch the data stream for start and end of programming sequence. I came to the conclusion that, although this could work, the first method would always be better. Also, the baud rate should be dynamically adaptable to see the end sequence where, in the mean time, the baud rate could have been ramped up. However, in case any one is interested in following this up, I'll leave the (experimental grade) code at the end of this document (scanSerial_V0_02.ino).
Using two DPDT switches, one for the 3.3v/5v swapping and one for the USB/UART role swapping could also simplify the design.
Other discussions on this theme:
This list is by no means comprehensive. Threads already mentioned are not repeated here;
Experimental detection of UPDI programming phase:
scanSerial_V0_02.ino (4.4 KB)
Schematic now updated to incorporate the following errata notice: The analog switch is of type CD74HC4052E and not as illustrated a CD4052B