Xiao ESP32c3 & SAMD21 USB issue

If this has been discussed before let me know. I couldn’t find anything relevant when searching.

Have a Xiao ESP32c3 that is connected to a 12v-5v VR. There is a diode between the output & Xiao. Having an issue with the USB connectivity though.

If I do the following steps all is well & works:
Plug Xiao USB into computer
USB detected & port # assigned
Xiao boots & up runs program
Plug in 12v
Disconnect USB
Xiao still running all is good

Now once I re-connect the USB port to the computer…it does not get detected.
Leaving the USB connected and disconnecting the 12 USB is immediately detected and assigned a com port.

This now leads to the 2nd issue. When this happens the Xiao restarts.

Basically the USB has to be connected first and then the 12v can be connected. The problem with this solution is that the device this is connected to is designed to allow it to run without being connected to a PC but if the user wants they can connect and run an app that will allow them to see the sensor data(SHT31 & ds18b20’s, pwm output levels).

The same behavior happens on the ESP32c3 & SAMD21 devices. This issue does not happen when using a ESP32-Wroom D1 Mini. I would use that to replace the Xiao but that would drastically increase the size of the circuit board and the primary reason for using the Xiao (small size).

Was able to also replicate this using just the simple Blink example so I know this isn’t a code issue.

Anyone ever see this before and if so, was there any way to resolve it or is it just the way that this board is designed/made?

Would think that anyone who has a battery connected to the 5v would also see the exact same thing. I dont have a battery to test out that idea, but would think the same thing happens.

What happens if you set the output voltage of a 12v-5v VR a little lower (e.g. 4.5V)?
What happens if you reset the XIAO when you reconnect the USB?

it is a fixed output on the vr not adjustable. I’ll try the reset button in a few.

pressing the reset button had no impact

went ahead and checked the voltage though. 5.0v before the 1N4007 & 4.22 after(and on the Xiao)

Is this anyway related to this: Device shows up as 'USB JTAG/serial debug unit' and cannot be flashed anymore

I am doubtful since the same issue happens with the SAMD version.

Every one of the 2 dozen esp32c3’s I tested though show the same vid/pid in USB Tree Viewer. The SAMD though shows the Seeed VID/PID.

I tried this with XIAO_ESP32C3 while running a simple Blink sketch. Port connections are checked with the PC’s device manager.

  1. Connect XIAO to USB → port is recognized
  2. Blink is executed
  3. 5V is supplied to the XIOA 5V pin → continues to run
  4. Disconnect USB → port disappears but continues to run
  5. Re-connect USB → port is recognized and continues to run

There seems to be no problem with connecting and disconnecting the USB.

I did it with even a blank sketch loaded. Same results on multiple devices.

Hard to believe it is firmware since it happens on 2 different models.

I take it you are not running a diode on yours?

Only other thing I haven’t tried is a different usb c cable

what kind of cable are you using? usb-c to usb-c or usb-c to usb-a?

Try a usb-c to usb-c cable.

Everything is good if using a usb-c to usb-a. Must be why many havent come across this before. I had to pull a laptop out of storage to test this cause every laptop I use now only has USB-C ports.

A Schottky diode is connected between the 5V supply and the 5V pin of XIAO.
The cable is USB-A of PC → USB-C of XIAO.
Unfortunately, my PC port is USB-A.

ok, that is the issue. It is when using USB-C on both ends. Tried multiple USB-C only cables and had the same bad result. When using USB-A all was sucessful

The 2nd issue still remains where the program will restart when opening up a serial connection though. Since we have wifi client enabled we can tell it happens with a simple ping.

Keep 5v connected
Connect & reconnect USB
Open Arduino IDE, select com port & open serial monitor (can also just use Putty if you want)

Simple blink example wont show it but if you have something that does serial.print, or have an OLED connected you will see it start to go through the normal program start. This happens any time you close the serial port and re-open it, just easy to tell with having the 5v always connected.