2024-04-03 06:05 AM
Hi all,
A USB device should pull up DP when it detects VBUS power only. This is described in the USB standards and ST AN4879 factsheet. Question 1. Is there any other (smarter) way with the STM32L072 than to monitor VBUS power on a GPIO yourself (via resistor voltage devider or active cirquit) and then toggle DPPU bit of USB_BCDR register yourself when input value of GPIO changes to implement this function? Question 2. Or is it normal to just set + leave DPPU bit high always (which implies that the device you are making is not really USB complient)? My bigger question off course is: how do I implement a complient USB device with a STML072?
Greetz & thanks,
Jan
Solved! Go to Solution.
2024-04-04 06:38 AM
Yes looks so. You can also use this to detect surprise-removal or unplug of USB cable and act accordingly (for example if you have pending data to send to the host)
2024-04-03 09:12 AM
Bus-powered devices do not need to detect VBUS.
2024-04-03 09:24 AM
It’s a self-powered device, sorry for not mentioning.
My question remains.
Kind regards,
Jan
2024-04-03 01:36 PM
Why it is so hard to just follow the standard requirement?
2024-04-03 03:00 PM
So I have to measure VBUS with a GPIO (in a loop, with a timer, interrupt on change) and set DPPU bit according?
2024-04-04 06:38 AM
Yes looks so. You can also use this to detect surprise-removal or unplug of USB cable and act accordingly (for example if you have pending data to send to the host)
2024-04-04 08:10 AM
Okay, thanks, and one more question. If I leave DP+ high (DPPU bit = 1) all the time (read: don't sync DP+ pull-up with VBUS 5V). What will be the troubles that I face in my (self-powered) USB (device) solution?
2024-04-04 11:58 AM
I don't know but usb.org has some procedures for testing device compliance. You can run your device & firmware thru their test.