My application has a commandline interface to the PC. One of the commands is to reboot-to-bootloader. When that happens I do: . In the past this used to work. Nowadays, it just hangs: The PC doesn't detect that the ttyacm0 is gone, and so doesn't re-enumerate the RP2040 as "usb stick".
I've been working around this by disconnecting the hub (but not pulling the plug far enough to disconnect power).
I was thinking this was "bad hardware" in the hub, bug after loading a new binary I've noticed that the bootloader manages to 100% reliably tell the hub that it's gone... So I'm hoping that its possible to fix in software.
I've tried chatgpt's suggestion to deinit the USB controller. That didn't work (didn't get the code to compile), and then I decided to look into the usb_init in the SDK and found the init starting with:and thought... That should be a pretty reliable way to reset/deinit the USB controller. But alas: Same behavior....
Any suggestions?
Environment: Ubuntu 22.04 on a PC with an USB hub. (without the hub it works normally)
Code:
reset_usb_boot (1 << LED_PIN, 0);I've been working around this by disconnecting the hub (but not pulling the plug far enough to disconnect power).
I was thinking this was "bad hardware" in the hub, bug after loading a new binary I've noticed that the bootloader manages to 100% reliably tell the hub that it's gone... So I'm hoping that its possible to fix in software.
I've tried chatgpt's suggestion to deinit the USB controller. That didn't work (didn't get the code to compile), and then I decided to look into the usb_init in the SDK and found the init starting with:
Code:
reset_block(RESETS_RESET_USBCTRL_BITS);Any suggestions?
Environment: Ubuntu 22.04 on a PC with an USB hub. (without the hub it works normally)
Statistics: Posted by rew — Mon Jun 30, 2025 9:46 am