2019-08-29 04:51 AM
I'm wondering how things work *without* VBUS sensing on, in particular, the STM32F401. From the documentation, I understand that:
However, it seems that running self-powered without VBUS sensing is also possible:
But I cannot quite find any documentation about the implications and limitations of disabling VBUS sensing.
In some places, I've found mentions that the "USB specs require VBUS sensing". Looking at the USB 2.0 specification, I've found these:
So, how does this work without VBUS sensing? Here's my hypothesis:
Summarizing, the downside of not having VBUS sensing is that you can violate the spec and leave pullups enabled when not allowed, and you cannot properly detect when a cable is removed? Can someone confirm that this is a correct understanding?
Then, I wonder how the bootloader works without VBUS sensing. I assume like above, but the flowchart in AN2606 (for the STM32F40xx in section 26.1.2) has a "USB cable Detected" check. If that cannot use VBUS sensing, then what does it detect exactly? Does it check whether the host has sent a reset/enumeration request? This happens before the clock is configured (according to the flowchart), so (I assume) no actual communication can happen to detect the cable (but it seems that a reset condition by the host is just 10ms of driving DP and DM low, which is probably more than enough time to be detected and initialize the clock?).
2019-08-30 12:17 AM
> Summarizing, the downside of not having VBUS sensing is that you can violate the spec and leave pullups enabled when not allowed, and you cannot properly detect when a cable is removed?
> Can someone confirm that this is a correct understanding?
Yes.
The history of USB is a history of standard violation from all sides (and a not very well thought out standard to start with).
While the Synopsys machine (the OTG IP in the 'F4) attempts to offload some of the protocol to hardware, most of it is handled in software anyway. So it's up to you how do you handle reset/suspend etc. events (unless you deem the example implementation provided by Cube/CubeMX as an unpenetreable and perfect black box).
JW
2019-09-04 05:27 AM
Thanks. In that case I guess I'm going to connect VBUS after all, so I can detect cable presence while in my application. When running the ROM bootloader, this might cause a USB spec violation, but that should be rare and not really problematic, so that seems acceptable.