My next project deals with a microcontroller supplied by mains without isolation. With these kind of boards, one should take great care during development to avoid lethal electric shocks. It is strictly forbidden to connect your usual debug interface to the board without precaution !
I usually use an AVR Dragon to program/verify software through the 6 pins ISP header. It also allows for debugging in-situ through the debugWire interface (requiring only 3 pins).
This project is an interface board, plugged between the ISP programmer (which can be either an AVR Dragon, but all ISP programming interfaces suited for Atmel's MCU will also work) and the target.
As power available is sometimes very low on the target, it will use its own 5V external supply (surely from another USB header or maybe an integrated battery compartment).
The project is still under its specification phase. I'll tell you more soon ! Keep in touch !
Edit 2014-02-16 : Some first requirements
On Atmel's debugging interfaces, both JTAG and ISP connections coexist. ISP is usually found on small MCU but it uses signals from JTAG header. While JTAG needs a 10-pins header, ISP is 6-pins only. This interface will support both modes, including DebugWire. There are 6 connections which cross the isolation barrier :
Host --> Target : TDO, SCK, TMS
Target --> Host : TDI, VCC
Both direction : nRst (debugWire)
Referring to EN60950 standard, we need to implement a double isolation, where we have to satisfy with 4mm creepage distance and air isolation. The system shall support a voltage of 3000Vac (4242Vpk) during 1 minute across its isolation.
This last criteria is the hardest to satisfy, you'll find that only a few digital isolators can whithstand this...
While the 5 first signals are quite straightforward to implement, the debugwire is a bit more complicated due to its bidirectionnal nature. An application note exist ("AVR077"), but I don't really like this old-school implementation. I think we can do simpler with modern parts.
The last point to solve is that target side can be powered from any voltage between 1.8 and 5Vdc. We'll have to use some kind of voltage level translators to comply with...
Edit 2014-02-20 : Schematics available
I've completed schematics drawing, you'll find it enclosed. There are more parts than I first thought, especially due to voltage level translators and debugwire implementation. As I used fast logic ICs, I also had to add some schmitt triggers to meet their rise time requirements.
Unfortunately, I had to decrease isolation requirements to only 3kVdc because isolated power supplies which meet this value are really hard to find or expensive. In real life, it won't be a big problem...
I'm working on layout now, the board will perfectly fit a hammond plastic case, for safety reasons again... More pictures soon !