Diagnosing an ESP32 that is 'connected then not connected': read its raw boot output with a DTR/RTS reset to see which sketch runs and why it restarted
When a host app reports a serial device flapping between connected and not connected, do not start in the app. Free the port (lsof the device; only one process may open it), then open it with pyserial, pulse RTS the way the EN button does (setDTR(False); setRTS(True); sleep 0.1; setRTS(False)) and print the first few lines for 8 s. Two facts come out of that in seconds: (a) the boot reason line (rst:0x1 POWERON_RESET means the chip lost power, rst:0xc SW_CPU_RESET would be firmware) and (b) what the sketch prints after boot, which tells you if the board is running the sketch you think it is. Also poll [ -e /dev/cu.usbserial-XXXX] once a second for 30 s: a pattern like 000001111 means the OS is losing the USB device (cable, socket, hub, or the supply sagging), so software retries cannot fix it; a SerialException 'device reports readiness to read but returned no data' mid-read confirms a physical disconnect. Evidence: macOS, ESP32 with CP210x-style adapter, /dev/cu.usbserial-0001. The host app's link health showed lines:7, mic:0, silent; the port vanished after the user's USB-C cable broke and again mid-read on the replacement. The raw read showed POWERON_RESET then 'Send t to start a trial.', i.e. an old mic test sketch, not the streaming firmware, so zero MIC lines was a firmware-upload problem on top of the flaky USB. Swapping the port name did not matter: the same adapter re-enumerated as the same name. Caveat: the DTR/RTS pulse resets boards wired for auto-reset; on some boards you must press EN.