procedure for sleep/wake of USB device w/TinyUSB? #339
Unanswered
myklemykle
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
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