cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L072 USB

JanAtze
Associate II

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

1 ACCEPTED SOLUTION

Accepted Solutions
Pavel A.
Evangelist III

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)

 

View solution in original post

7 REPLIES 7
Pavel A.
Evangelist III

Bus-powered devices do not need to detect VBUS.

 

 

It’s a self-powered device, sorry for not mentioning.

My question remains.

Kind regards,

Jan

Pavel A.
Evangelist III

Why it is so hard to just follow the standard requirement?

So I have to measure VBUS with a GPIO (in a loop, with a timer, interrupt on change) and set DPPU bit according?

Pavel A.
Evangelist III

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)

 

JanAtze
Associate II

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?

Pavel A.
Evangelist III

I don't know but usb.org has some procedures for testing device compliance. You can run your device & firmware thru their test.