You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using TinyUSB on the RP2040 with Earle Philhower's Arduino-pico core, and I'm trying to work out the best procedure for sleeping & waking the USB subsystem. It goes like this:
to sleep:
Serial.end(); // halt USB serial port
pll_deinit(pll_usb); // halt USB clock
to wake:
pll_init(pll_usb, 1, 1440000000, 6, 5); // return USB clock to 48mhz
tusb_init(); //Adafruit/TinyUSB usb init
Serial.begin(115200);
I found that I had to add tusb_init() after restarting the USB clock, or else I got no communication. But I've also found that the USB subsystem can be flaky after I do this. It seems like the more USB Serial data is being sent after sleep/wake, or the sooner after sleep/wake, the more likely that my chip will lock up and reboot. Also the USB host sometimes drops communication after sleep/wake. In that case I can re-establish it by unplugging and replugging the usb cable.
I wonder, am I doing this right? Is this the right procedure for stopping and restarting TinyUSB? I did not find a tusb_deinit() API call to use before sleep. And I just copied tusb_init() out of the arduino-pico startup code, I don't really grok all that it does. Do I need to notify the USB host somehow after wakeup, to trigger a reset of the whole connection?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi,
I'm using TinyUSB on the RP2040 with Earle Philhower's Arduino-pico core, and I'm trying to work out the best procedure for sleeping & waking the USB subsystem. It goes like this:
to sleep:
to wake:
I found that I had to add tusb_init() after restarting the USB clock, or else I got no communication. But I've also found that the USB subsystem can be flaky after I do this. It seems like the more USB Serial data is being sent after sleep/wake, or the sooner after sleep/wake, the more likely that my chip will lock up and reboot. Also the USB host sometimes drops communication after sleep/wake. In that case I can re-establish it by unplugging and replugging the usb cable.
I wonder, am I doing this right? Is this the right procedure for stopping and restarting TinyUSB? I did not find a tusb_deinit() API call to use before sleep. And I just copied tusb_init() out of the arduino-pico startup code, I don't really grok all that it does. Do I need to notify the USB host somehow after wakeup, to trigger a reset of the whole connection?
Much obliged for any advice.
Thanks,
-mykle-
Beta Was this translation helpful? Give feedback.
All reactions