Skip to content

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

Merged
merged 2 commits into from
Oct 17, 2019

Conversation

hugueskamba
Copy link
Contributor

Related to: ARMmbed/mbed-os#11635


## 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.
Copy link
Member

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hugueskamba hugueskamba force-pushed the hk-add-usb-deepsleep-block-info branch from e25e1a2 to edd95c7 Compare October 11, 2019 08:39

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()`.
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor

@AnotherButler AnotherButler left a 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.

@hugueskamba
Copy link
Contributor Author

Please review my changes to make sure I didn't accidentally change the meaning of anything.

@AnotherButler
LGTM.


## 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.
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

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.
@hugueskamba hugueskamba force-pushed the hk-add-usb-deepsleep-block-info branch from 9fe5aa8 to bf213b9 Compare October 16, 2019 07:11
@AnotherButler AnotherButler merged commit 2915dee into development Oct 17, 2019
@AnotherButler AnotherButler deleted the hk-add-usb-deepsleep-block-info branch October 17, 2019 20:00
AnotherButler pushed a commit that referenced this pull request Oct 17, 2019
Apply changes from PR #1154 to v5.14.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants