cancel
Showing results for 
Search instead for 
Did you mean: 

PA9 as VBUS sense of USB_OTG_FS (STM32F407)

Posted on August 24, 2017 at 15:33

I played with PA9 on a DISCO-F4 board in its OTG_FS_VBUS function. This is a non-AF function, i.e. it's connected to PA9 all the time, and is supposed to be governed by USB_OTG_FS settings. I am not interested in OTG so this experiment was performed in forced-device mode, GUSBCFG.FDMOD=1.

As it is connected through a 47kOhm resistor to base of a transistor switching on the green 'VBUS-present' LED, this consumes around 57uA from a 3.3V source. This includes some leakage current into PA9's GPIO digital-input Schmidt which is supposed to be below 1uA. I subtract these from subsequent pulldown-current measurements, so in following I'll give a net current flowing into the USB PHY's VBUS pad from a 3.3V input.

a. After setting GCCFG.VBUSASEN, a 0.8uA current was seen, which is probably leakage into the PHY's input 'comparator', which IMO is a Schmidt trigger of the same build than the GPIO digital input. When changing input voltage, both GOTGCTL.ASVLD and GOTGCTL.BSVLD change simultaneously from 0 to 1 when voltage rises above some 1.5V and from 1 to 0 when falls below some 1.2V. The GPIOA.IDR9 behaviour is exactly the same, although with very careful voltage change very close around the boundary (cca 50mV) I was able to achieve a state where the two had different values, so the two Schmidts are separate - this also confirms the source of extra leakage current.

b. Setting GCCFG.VBUSBSEN introduced a cca 90uA current, i.e. cca 37kOhm (probably nominally 40kOhm) pulldown has been switched on. This pulldown is extra to the GPIO pulldown - when GPIOA.PUPDR9 is set to 2 the current roughly doubles. The 'digital' behaviour when changing input voltage is the same as above, with the same two bits being set simultaneously at the same voltage levels.

c. Setting GCCFG.NOVBUSSENS doesn't appear to change the current consumption as described above, but it does set unconditionally both GOTGCTL.ASVLD and GOTGCTL.BSVLD as promised.

Questions/suggestions:

1. STM32F407 DS (DocID022152 Rev 😎 in Table 58 gives for PA9 value of RPD as 1.1kOhm and RPU as 0.37kOhm. As said above, the VBUSBSEN pulldown is around 40kOhm. Under which conditions would we see these strong PU/PD in action?

2. Please mention the additional pulldown switched on with GCCFG.VBUSBSEN, and the ineffectivity of GCCFG.NOVBUSSENS in disconnection of these features from the pin itself.

Comments welcome.

Jan Waclawek

0 REPLIES 0