SpenceKonde / AVR-Guidance

A guide to best practices when using the Arduino IDE to program AVR microcontrollers
146 stars 23 forks source link

UPDI programming using Raspberry GPIO without USB to TTL #13

Open pippopippo69 opened 1 year ago

pippopippo69 commented 1 year ago

Hi, I am programming an attiny816. Everything works fine with USB to TTL Cable but no way to program it using Raspberry GPIO without USB to TTL..any hint ? Raspberry GPIO electric level is 3.3V and attiny816 is 5V, but attiny816 can read a 3.3V signal correctly. Is a level shifter needed? Has it to be OpenDrain or with a specific output? tks

SpenceKonde commented 1 year ago

This is tricky. The main problem is that most level shifters will trash the UPDI signal coming back from the target. To get an idea of what the UPDI pin on the target is capable of as far as drive strength is concerned, imagine a normal I/O pin with a 2.2-2.5k resistor in series with it. That is weak enough that most level shifter designs will fail to correctly operate. (note on the Dx and Ex parts, it's a normal I/O pin in strength).

You could program at 3.3v running the 816 at 3v3 if the PI has a UART by duplicating the SerialUPDI approach. You would likely need to set the write delay when invoking SerialUPDI (USB latency is sufficiently painful that . I'm not experienced with the Pi, but if someone described an approach that worked and what options were needed to make SerialUPDI work, I would add SerialUPDI via RPI GPIO to the programmer menu