Enabling UPDI with high-voltage pulse on _RESET in AVR Dx family (DA, DB, DD...) - Page 1
Forum section: electronics / general

author: octillion
author_rank: Contributor
timestamp: May 01, 2025, 05:52:51 pm
content: I have a AVR64DD14 where the UPDI pin has been configured for GPIO, which requires a high-voltage pulse on the _RESET pin to re-enable UPDI. I have been unable to re-enable UPDI with the PICkit 4 or PICkit 5 and the latest software (MPLAB X IDE v6.25, AVR-Dx_DFP 2.7.321), and want to see if others have experience re-enabling UPDI on these devices.The device is connected to the PICKit using the "UPDI Connection v2" configuration described in section 4.4.2 (page 19) of the datasheet.The high-voltage pulse protocol is described in section 36.3.2.1.2 (page 548).https://ww1.microchip.com/downloads/aemDocuments/documents/MCU08/ProductDocuments/DataSheets/AVR64DD-14-20-DataSheet-DS40002444.pdfThe high voltage pulse is also described on the bottom of page 28 of the PICkit 5 user's guide.https://ww1.microchip.com/downloads/aemDocuments/documents/DEV/ProductDocuments/UserGuides/MPLAB-PICkit-5-In-Circuit-Debugger-Users-Guide-50003525.pdfI have the _RESET line connected directly to the PICKit with no other circuitry (there was a 100 nF filtering capacitor, as shown in section 4.3, which I removed). The only other connection to the UPDI pin aside from the PICKit is a comparator with an open drain output which is not active during programming (and I have verified by checking that the voltage of the UPDI pin is at VDD from internal pull-up).High voltage activation mode has been enabled in PICkit communications, and I've tried a range of communication speeds from 0.1 to 0.75 MHz.I had no problem communicating with and programming the device up until I cleared the SYSCFG0 UPDIPINCFG configuration fuse to use the UPDI pin as GPIO.Thanks

author: westfw
author_rank: Super Contributor
timestamp: May 02, 2025, 01:45:53 am
content: QuoteCould that have clamping diodes to your regular Vcc, or some other internal circuitry that interferes with the HV pulse, even when it's "not active"?Do you have a scope that can check whether the HV pulse is actually occurring?Are you sure your PICKit firmware is up-to-date (I think MPLAB does that automatically, but I'm not sure...)

author: PCB.Wiz
author_rank: Super Contributor
timestamp: May 02, 2025, 02:41:59 am
content: Quote from: octillion on May 01, 2025, 05:52:51 pmDid you check RESET is able to be driven > Vcc ? Open drain may not guarantee no clamp diodes.

author: octillion
author_rank: Contributor
timestamp: May 02, 2025, 02:53:41 am
content: Quote from: westfw on May 02, 2025, 01:45:53 amI have upgraded all software/firmware to the latest version in hopes that could be the issue.The HV pulse is on _RESET (not UPDI). In any case, the comparator's V+ rail is around 16 V, it only clamps the output voltage against the V- rail (which is grounded), and this device supports 40 V on the output.To remove all doubt, I have now removed everything from the UPDI line as well. Attached are traces showing the HV pulse on RESET, and subsequent data on UPDI.Anyway, good suggestions.

author: octillion
author_rank: Contributor
timestamp: May 02, 2025, 03:00:40 am
content: ...and here are traces with _RESET and UPDI only connected to the oscilloscope... so that glitch in UPDI after the HV pulse is inherent in what the PICkit sends.

author: westfw
author_rank: Super Contributor
timestamp: May 02, 2025, 07:09:32 pm
content: QuoteI don't see the Handshake/Break on UPDI (Tupdi) that I expect after the HV pulse...

author: octillion
author_rank: Contributor
timestamp: May 03, 2025, 08:02:36 pm
content: Quote from: westfw on May 02, 2025, 07:09:32 pmYes, something is wrong with the handshake... That little glitch on UPDI right after the _RESET pulse is the start of the handshake initiated from the PICkit. As per section 36.3.2.1.1, it must be at least 200 ns long; in this case, it's 400 ns, and the AVR is ignoring it.Section 14.3.2.1.7 states "A device Reset is issued if a high voltage is applied to or removed from the RESET pin. Using the HV pulse to enable the UPDI will trigger a device reset." and section 36.3.2.1.2 "This will override the pin configuration of the UPDI pin. The HV detection circuitry will trigger a device Reset. The CPU will remain halted until the reception of a valid UPDI key, or the expiration of TUPDI_TIMEOUT". I thought it was strange that the PICkit was pulling the _RESET line low before and after the HV pulse, as this seems unnecessary; the HV pulse alone should both enable UPDI temporarily and initiate reset. Given that,I put a diode inline on _RESET so only the HV pulse would be allowed through, and all is well. I can again communicate with and reprogram.Attached are the traces after adding the diode. The UPDI pin on the AVR continues to act as UPDI until POR, so if power remains applied I can communicate multiple times without requiring the HV pulse.Interestingly, I found that the PICkit first tries to communicate without the HV pulse, and only if that fails will it try with the HV pulse on _RESET. This is a nice feature, as if you mistakenly leave the HV pulse communication enabled when talking to a device that does not require it and potentially has circuitry attached which will not survive the pulse, this reduces the risk of damage. The image full_comm_until_fail.png shows this protocol when no device is attached. First communication attempt is on the far left (only a couple pixels wide due to wide timescale), and only after a little over 500 ms does it try initiating communication with the HV pulse.

author: westfw
author_rank: Super Contributor
timestamp: May 03, 2025, 11:27:14 pm
content: QuoteHmm. I was talking about the "BREAK" character that supposed to be 10 to 200microseconds long (a proper async "BREAK"; longer than a full byte transmission time.)But the datasheet I'm looking at (DS40002315B for AVR64DD32) is pretty confusing WRT to whether that is needed when trying to enter UPDI with the HV pulse on RESET.

author: octillion
author_rank: Contributor
timestamp: May 04, 2025, 01:41:06 am
content: I don't think we should expect to see a BREAK character immediately after a HV pulse, just a standard handshake.In the failure cases above the PICkit sends the HV pulse on _RESET, sends an initial handshake on UPDI, then polls UPDI to check when it is pulled back high (in this case the MCU never pulled UPDI low as part of the handshake, but the PICkit just interprets that as a very fast handshake). Now that the handshake is done, the PICkit waits for time t_DebZ (something between 200 - 14000 us), then sends SYNC character and key signature.We see two BREAK characters before the HV pulse after the PICkit attempted communication without sending the pulse (section 36.3.1.2 of DS40002444B states why these come in pairs)https://www.eevblog.com/forum/microcontrollers/enabling-updi-with-high-voltage-pulse-on-_reset-in-avr-dx-family-(da-db-dd-)/?action=dlattach;attach=2559388These are ~25 ms, which is a BREAK character covering the slowest possible UPDI clock prescaler (default). There may be additional BREAK characters after the HV pulse fails communication, but I didn't record traces long enough to check this.