I have an issue with ATXMEGA64A1 (the one with a long errata list).
On a batch of ten PCBs, about half of them exhibits the following behavior:
Everything is working fine after the first programming, but when the ISP dongle (Atmel ICE) is disconnected and reconnected, execution stops and the PDI interface stops working. Target voltage can correctly be read to 3.3 V, but device signature can not be read. Needless to say, none of the other controls in the Atmel studio device programming dialog are available.
("PDI enable failed. Debugger command Activate physical failed.
Unable to enter programming mode. Verify device selection, interface settings, target power, security bit, and connections to the target device.")
This behavior can also be trigged by SW when I erase the upper half of application section, which is not used by application code.
This makes be think that the problem is not the PDI itself, but the NVM controller.
The MCU stays in this state after power cycle, so it seems more or less bricked. The only way to make it exit the state is by using some cooling spray on the MCU (or unplug it and wait a long time, but I guess it is related to cooling down as well). When using cooling spray (with power applied), the execution will resume within a few seconds, and I can now read signature, set fuses, write new binary etc. I have to be fast though, because when the MCU heats up PDI will become unavailable again. However, execution will continue until the dongle is unplugged and replugged.
And when I say warm up, I mean slightly above room temperature, approx 30-35 degrees C.
Note that the same code works fine on about 50% of the boards.
The ISP connector is located about 4 cm from the MCU, and there is nothing on the data and clock lines except for a 20 k pull up on reset.
Running the PC on battery makes no difference, so no ground loop as far as I know.