Skip to content
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

self-powered device #12

Open
jerrymessina opened this issue Jan 6, 2016 · 5 comments
Open

self-powered device #12

jerrymessina opened this issue Jan 6, 2016 · 5 comments

Comments

@jerrymessina
Copy link

Does the stack have support for a self-powered device?

If not, what sort of changes would be required to support this?

@signal11
Copy link
Owner

signal11 commented Jan 6, 2016

It has been used with self-powered devices. Is there something specific in your question?

@jerrymessina
Copy link
Author

In the Microchip stack I see code to monitor an IO pin connected to USB VBUS (or some bits in the USB OTG status reg on some chips) and I didn't see this in the mstack code.

I was under the impression that a self-powered device had to be able to detect when a host was attached and supplying power... something to do with enabling the pullups on the USB data line(s)?

@signal11
Copy link
Owner

In the Microchip stack I see code to monitor an IO pin connected to USB VBUS (or some bits in the USB OTG status reg on some chips)

Did you determine what it does?

I was under the impression that a self-powered device had to be able to detect when a host was attached and supplying power... something to do with enabling the pullups on the USB data line(s)?

Have a look at the specification to be sure.

The pullups indicate connection and speed to the host.

@jerrymessina
Copy link
Author

Did you determine what it does?

From what I can tell this is used to enable/disable the D+ pullup until it senses that the host is providing power on VBUS.

from usb2 spec section 7.1.5.1 Low-/Full-speed Device Speed Identification:

The voltage source on the pull-up resistor must be derived from or controlled by the power supplied on the USB cable such that when VBUS is removed, the pull-up resistor does not supply current on the data line to which it is attached

For a bus-powered device this isn't an issue since the pullup voltage is derived from VBUS, but for a self-powered device it's possible to init the USB peripheral and enable the pullup when there's no VBUS, violating the above. I've seen comments that this can cause enumeration issues on some systems.

Do I have that right?

@signal11
Copy link
Owner

I'm not sure about causing enumeration issues, but it's possible. I think you are correct. In this case, don't call usb_init() until you detect VBUS. There is not currently support to turn off USB in M-Stack. Patches are welcome for that. I don't have much time to look at it right this minute though, unfortunately.

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

No branches or pull requests

2 participants