Page 1 of 1

Lyra Zero W: dwc2 gadget disconnects ~0.5-0.9s after enumeration

Posted: 2026-08-11 20:32
by pfrey

I have an issue with the Lyra Zero W. Currently only able to access it through serial console.
My Hardware:
- 2x Luckfox Lyra Zero W (RK3506B), same supplier, same order date
- Firmware: Luckfox_Lyra_Zero_W_Flash_250717.zip (also tested SD Buildroot variant)
- Kernel: Linux luckfox 6.1.99 #16 SMP PREEMPT Tue Jul 22 11:32:56 CST 2025 armv7l GNU/Linux
- U-Boot: 2017.09-g4d88b0a (Jul 30 2025)

Problem is USB gadget (dwc2) disconnects ~0.5-0.9s after enumeration.
Once booted, the USB gadget (RNDIS network + adb via usbdevice/configfs, functions: rndis.0 + ffs.adb) enumerates correctly on the host but disconnects almost immediately:

Code: Select all

usb 3-2.1: New USB device found, idVendor=2207, idProduct=0006 (or 0013)
rndis_host 3-2.1:1.0 usb0: register 'rndis_host' ...
usb 3-2.1: USB disconnect, device number X

Board-side dmesg shows:

Code: Select all

dwc2 ff740000.usb: dwc2_hsotg_txfifo_flush: timeout flushing fifo GRSTCTL_TXFFLSH
dwc2 ff740000.usb: dwc2_hsotg_ep_stop_xfr: timeout GINTSTS.GOUTNAKEFF
dwc2 ff740000.usb: dwc2_hsotg_ep_stop_xfr: timeout DOEPCTL.EPDisable

Ruled out as causes:
- Wi-Fi/BT driver load timing (disabled S35wifibt-poweron.sh/S36wifibt-init.sh — disconnect still occurs at the same relative timing)
- Host-side factors: NetworkManager (confirmed reactive via journalctl, device disappears at kernel level before NM acts), firewall/UFW (operates above USB layer), USB hub chain (reproduced via direct motherboard port), cable, USB autosuspend
- Gadget function combination: reproduced with RNDIS+adb together AND adb-only (fewer endpoints didn't help — disconnected even faster, ~0.48s, with adb alone; adb never completes its CNXN handshake, stays "offline")
- Reproduced identically on both units — systemic, not a per-unit defect
- Not related to boot media (identical on SPI-NAND and SD boot)

Attempted to test CDC-ECM as an alternative to RNDIS (per known upstream dwc2 RNDIS-vs-ECM stability differences, e.g. raspberrypi/linux#2962), but mkdir /sys/kernel/config/usb_gadget/*/functions/ecm.usb0 fails with No such file or directory, suggesting CONFIG_USB_F_ECM isn't built into this kernel.

Additional note (not a bug report, just documentation): the BOOT button triggers U-Boot's recovery-mode key press (download key pressed... entering recovery mode!), not bootROM-level Maskrom — it drops to a live U-Boot => prompt rather than exposing a USB download-mode device. From there, rockusb mode has no usable target for this hardware config: rockusb 0 mmc 1 is explicitly blocked ("Forbid to flash mmc 1(sdcard)"), mmc 0 has no device present (no eMMC), and SPI-NAND is only exposed via the mtd subsystem, not as a rockusb-compatible block device. The FSPI_CLK/GND hardware short into true Maskrom remains the only working flash-entry method found for this board's SPI-NAND.

Questions for any experts:
- Is the dwc2 gadget disconnect a known kernel/driver bug on RK3506B's dwc2 controller? Is there a patched kernel, updated S45usbconfig/usbdevice build, or documented fix available?
- Is CDC-ECM support planned/available in an alternate defconfig, given RNDIS consistently triggers this dwc2 timeout while adb-only doesn't improve things either?
- Is rockusb-based SPI-NAND flashing from U-Boot recovery mode supported at all on this board, or is Maskrom the only intended path?

Happy to provide full boot logs, lsusb -t trees, udevadm monitor captures, or test further changes if it helps track this down.
Attached some system/build infos.