I wanted the MCU I'm using, samd21g, to detect when USB is connected on the board. The USB is used to power some other things on the board and currently isn't connected to the MCU. Also, the MCU can only handle 3.3V. I have a pin open on the MCU that I can connect the power of the USB to it through a voltage divider for example and I can detect when it goes high, but I'm worried that there could be too much current that would flow into that MCU pin. So I wanted to know, what is the best way to detect when the USB is connected?