-
Notifications
You must be signed in to change notification settings - Fork 178
Add information on power saving options for USB components #1154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
docs/api/usb/usb_component.md
Outdated
|
||
## USB component and power saving | ||
|
||
Instantiated USB components prevent devices from going to deep sleep due to USBPhy holding a deep sleep lock. It is possible to temporarily disable USB using `USBDevice::deinit()` to permit deep sleep. However, it is up to the user to make sure all the data transfers have concluded (for example when USB power is lost) to avoid any data corruption. The USB host controls the enumeration process so it chooses when and how the device will be restored. Even if the device state is returned to what it was before the disconnect, the host PC software may not be where it left off - for example a serial port may need to be re-opended by the user. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(for example when USB power is lost)
i'm not sure I follow what does this mean, you mean it's a similar situation hen usb power is lost?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
e25e1a2
to
edd95c7
Compare
|
||
Instantiated USB components prevent devices from going to deep sleep because USBPhy holds a deep sleep lock. You can temporarily disable USB using `USBDevice::deinit()` to permit deep sleep. However, you must make sure all the data transfers have concluded to avoid any data corruption. The USB host controls the enumeration process, so it chooses when and how to restore the device. Even if the device state is returned to what it was before the disconnect, the host PC software may not be where it left off - for example, you may need to reopen a serial port. | ||
|
||
You can use `USBDevice::connect()` to resume USB component operation when USB power is detected after it was previously suspended through `USBDevice::deinit()`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you suggest a way to rephrase this sentence? I had to read it a few times for it to make sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not mind your edit if it removes the confusion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please review my changes to make sure I didn't accidentally change the meaning of anything.
@AnotherButler |
docs/api/usb/usb_component.md
Outdated
|
||
## USB component and power saving | ||
|
||
Instantiated USB components prevent devices from going to deep sleep because USBPhy holds a deep sleep lock. You can temporarily disable USB using `USBDevice::deinit()` to permit deep sleep. However, you must make sure all the data transfers have concluded to avoid any data corruption. The USB host controls the enumeration process, so it chooses when and how to restore the device. Even if the device state is returned to what it was before the disconnect, the host PC software may not be where it left off - for example, you may need to reopen a serial port. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instantiated USB components prevent devices from going to deep sleep because USBPhy holds a deep sleep lock.
Note - this is implementation defined. Nothing requires a USBPhy to lock deep sleep, all implementations currently do though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually not all implementations do, the Cypress one does not.
https://github.com/ARMmbed/mbed-os/blob/master/targets/TARGET_Cypress/TARGET_PSOC6/cy_usb_phy.cpp#L57
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR fixes the Cypress USBPhy.
Edit file, mostly for active voice.
9fe5aa8
to
bf213b9
Compare
Apply changes from PR #1154 to v5.14.
Related to: ARMmbed/mbed-os#11635