I'll update/close this Customer Rant Support Ticket once I've received the new relays and confirmed my rookie mistake; sourcing low quality relay parts that is :/ Let's hope its only that, fingers crossed
I don't think the particular relay type is the issue. Any mechanical relay will create interferences like that.
Your problem really is an EMC issue, the relay part of your circuit is disturbing either the power supply or the MCU. Not so uncommon to be seen.
Does the circuit work if the debugger isn't connected? Is there a difference if the load is connected or not?
Some things come to my mind:
- Check with debugger connected / not connected
- Check with load connected / not connected
- Look at your power supply decoupling and GND planes whether they're appropriate. (2)
- Try the snubber across the relay contact to dampen the source of the interferences.
- Run a short and massive "earth" wire from circuit GND to a solid GND point on your computer, e.g. the shell of a DSUB connector. (1)
- Connect your circuit GND to earth (either directly or through a capacitor)
- Place one or more clamp-on ferrite cores on your debugger cable
- Often an Y-type capacitor placed at the right nodes helps (try isolated circuit GND to primary side of the SMPS - e.g. using a 2.2nF Y-capacitor - using the correct capacitor is quite important for your personal safety)
(1): Why do I recommend doing so: I've seen more than once USB and debugger to target connections not being able to deal with the slightest common mode interferences, often due to poor shielding / grounding. Bypassing that path with a short wire tells you a story. "Short" is in the ballpark of 10 ... 20cm wire length here.
(2) This is one of the most often seen rookie mistakes: Not making a solid enough GND plane and / or poor decoupling.
Your layout (especially the mix of mains / LV traces to be seen in one of the pictures) is a potential source of common mode interferences from mains potential to your circuit. As you've experienced, these happen when the relay contact opens or closes.