I designed a PCB with an STM32 and a micro USB connector. I put a NUF2042XV6T1G between the connector and the STM32 to protect the data lines. The USB shield is connected to system ground via a 120R@100MHz ferrite bead.
The board has a power prioritization scheme going on, so it can be either bus powered, powered via a power supply or from a battery. I tested the prioritization circuit extensively, and the priorities and the make-before-break behaviour work just fine.
However, I noticed that when the board ground is referenced to mains earth via the power supply, the STM sometimes resets when I plug in the micro USB cable. At first I thought that the make-before-break doesn't work reliably, but that is not the case. Then I noticed that it is enough to touch the micro USB plug's shield to the receptacle's shield to crash the CPU. So I had a look at what's going on on the USB shield when not connected to my board:
Above is the shield voltage (referenced to mains earth) when the USB cable is plugged into a cheap chinese USB power supply (no mains earth connection).
Above is the shield voltage (referenced to mains earth) when the USB cable is plugged into a genuine Apple USB power supply (no mains earth connection either). Not as bad as the chinese one, but I'm still shocked (fortunately only figuratively. I don't notice anything when touching the shield with my finger).
I noticed that the CPU does not reset if I touch the USB plug's and receptacle's shield with my finger before connecting the metal parts when plugging in
So the question here is: How should I connect the receptacle's ground to the circuit ground to avoid this issue and stay clear of EMI issues? A high resistance (1M or so) instead of the ferrite bead? Both in series? Both in parallel (makes no sense to me)? Capacitively couple them?