AnsweredAssumed Answered

STM32L151 USB - What actually switches PA11/PA12 from GPIO to USB?

Question asked by JC on Aug 20, 2012
Latest reply on Oct 7, 2015 by Zirconium
I have a design that was switched from an STM32F103ZDT6 to a STM32L151ZDT6. On the 'F103, the USB functioned perfectly, but on the 'L151, I'm having trouble getting it going. 

Looking at all the various source in the STM32_USB-FS-Device_Lib_V3.4.0 files, NOWHERE does it ever set GPIO_AF_USB to configure PA11/PA12 from GPIO to USB. As near as I can tell, it appears that this may happen as soon as the RCC_APB1ENR_USBEN bit is set in RCC_APB1ENR.

Is this actually the case? If so, I cannot find ANY references in the documentation that GPIO_AF_USB in the GPIOx_AFR registers, along with GPIO_Mode_AF and the various pull-up/pull-down bits do not need to be set for the USB peripheral.

If this is the case, why does GPIO_AF_USB in the GPIOx_AFR registers even exist?

--jc

Outcomes