Determine USB Host

sshwarts
Posts: 3
Joined: Sun Dec 16, 2018 3:32 pm

Determine USB Host

Postby sshwarts » Wed Apr 02, 2025 7:32 pm

In the device we're developing, we have two basic operational modes. One being a USB HID Host and the other being as a MSC Device. I have hardware that tells me if the source of power (am I receiving power as a UFP or am I providing power as a DFP.

What I can't tell in the UFP case is if I'm connected to a host computer or a charger. I've tried looking at the D+D- lines to see if I can detect the host pulling them high, but it doesn't work, I suspect, at boot, someone already has control of those IO lines.

Does anyone know a reliable way to tell?

Since it's two different stacks (MSC is tiny USB), there's probably no way to switch on the fly, and a reboot is required (that's ok if detection works).

Thanks

ahsrabrifat
Posts: 201
Joined: Sat Jan 18, 2025 2:31 pm

Re: Determine USB Host

Postby ahsrabrifat » Thu Apr 03, 2025 7:18 am

A USB host typically provides 5V on VBUS, but so does a charger. However, a USB host usually limits current to 500mA (USB 2.0) or 900mA (USB 3.0) unless proper enumeration occurs.

Who is online

Users browsing this forum: Bing [Bot], ChatGPT-User, DuckDuckGo [Bot], Semrush [Bot] and 1 guest