2021-01-05 05:10 PM
After using STM32F417VGT6 chip, PA11 PA12 is configured as USB HOST (non-OTG mode, HNP or SRP mode is not used), PA9 cannot be configured as input pull-up mode; without USB HOST, PA9 can be configured as input pull-up Yes; try to configure PA9 to output pull-up or serial port can be used normally; configure PA9 to input pull-up mode, without connecting any peripherals, measure PA9 pin as low level. When using PA11 PA12 USB HOST, do you configure PA9 as input pull-up?
2021-01-05 05:15 PM
Sorry, my chip model is wrong, it is STM32F205RET6.
2021-01-05 11:36 PM
Is this some "library" like Cube? Then read the library's manual to find out how to avoid VBUS sensing. It's controlled by bits in GCCFG register which override any GPIO setting for PA9.
JW
2021-01-06 01:21 AM
Thank you very much JW.
My USB library version is relatively old, not cube. Check the GCCGF register, there are two positions (NOVBUSSENS and VBUSASEN) that will affect VBUS. According to the register analysis, NOVBUSSENS controls whether the VBUS sense is valid; check the drive code NOVBUSSENS is set to 1, and VBUSASEN is also set to 1; According to the manual analysis, it should be that VBUS sense is invalid. In fact, PA9 still cannot be used as an input pull-up; try to set VBUSASEN to 0, PA9 can be used as an input pull-up.
If so, JW would you please help me analyze if there is a problem with my modification?
Anyway, thank you JW.
Modify the code:
GCCFG register:
2021-01-06 01:22 AM
Thank you very much JW.
My USB library version is relatively old, not cube. Check the GCCGF register, there are two positions (NOVBUSSENS and VBUSASEN) that will affect VBUS. According to the register analysis, NOVBUSSENS controls whether the VBUS sense is valid; check the drive code NOVBUSSENS is set to 1, and VBUSASEN is also set to 1; According to the manual analysis, it should be that VBUS sense is invalid. In fact, PA9 still cannot be used as an input pull-up; try to set VBUSASEN to 0, PA9 can be used as an input pull-up.
If so, JW would you please help me analyze if there is a problem with my modification?
Anyway, thank you JW.
Modify the code:
GCCFG register:
2021-01-06 04:17 PM
I don't know if your code is in any way dependent on the sense enabled by VBUSASEN, but quite likely it's not.
Setting GCCFG.NOVBUSSENS has the same effect than pulling VBUS pin high, regardless of GCCFG.VBUSBSEN. I'm not sure about VBUSASEN, but I'd be surprised if it would be different.
JW
2021-01-06 05:26 PM
Thank you JW.
The board I use is self-powered and does not require VBUS sense. The program controls whether to turn on VBUS sense according to whether the macro VBUS_SENSING_ENABLED is defined; if the code is not modified, VBUSASEN is always 1, and the VBUS sense is controlled by NOVBUSSENS set to 1 or 0.
After communicating with you, I found a better modification method as follows.