cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L476 USB device does not work

krestan
Associate II
Posted on July 07, 2016 at 17:08

I've a big problem to make USB device working on STM32L476 device. I've tried my board, STM32L476 discovery and the results are the same, so I gues it must be firmware issue. I've used code generated from ST Cube and it fails before enumeration. If I set VBUS sensing disable, then windwows come with message ''can not recognize USB device''. There is some communication going on the usb pins, measured by oscilloscope, but it's all what I can see. With VBUS sensing disabled nothing happends at all, niether OTG IRQ calls. If I hold BOOT0 pin at VDD on the same board and try to connect USB, then the USB is working from the bootloader so the hardware part must be good.

3 REPLIES 3
Walid FTITI_O
Senior II
Posted on July 12, 2016 at 13:30

Hi krestan.michal.001,

If, you are using the discovery, try first to upgrade the ST-Link firmware to the version V2-1 from this

http://www.st.com/content/st_com/en/products/development-tools/hardware-development-tools/development-tool-hardware-for-mcus/debug-hardware-for-mcus/debug-hardware-for-stm32-mcus/st-link-v2.html

. Otherwise, if you are dealing with your own PCB, I suggest to check the USB HW connections by comparing with the schematics provided in one of the STM32L4 board user manuals; exp

http://www.st.com/content/ccc/resource/technical/document/user_manual/d1/84/86/4b/08/82/47/91/DM00172179.pdf/files/DM00172179.pdf/jcr:content/translations/en.DM00172179.pdf

Check also that needed 48MHz USB clock is provided (HSE is there ).

-Hannibal-

krestan
Associate II
Posted on July 13, 2016 at 01:06

Hi,

I've done ST link upgrade, debugger and the code is woking, but USB OTG is not working at all. Why do I need HSE? I'm using STM32L476 discovery board, where is only 32kHz LSE and the internal bootloader can work with this. I've shorted BOOT0 pin to gnd and the board can connect in DFU mode to the computer without any HSE and crystal soldered to the board, it's using only 32kHz. I'd like to use the same in PLL mode as described in the datasheet of STM32L476. Is there any sample code for STM32L476 discovery, where is USB device working? If I select vbus sense to disable, I only got to point where internal pull-up is enabled, the OTG IRQ is called, but the computer does not recognize the device.

Posted on July 13, 2016 at 02:16

I think the key take-away from ''Check also that needed 48MHz USB clock is provided'' is that you need to verify the 48 MHz clock source.

Either MSI, PLL48M1CLK (PLL), or PLL48M2CLK (PLLSAI1), are at 48 MHz and suitably gated to the USB/RNG/SDMMC peripheral clocks. If the USB peripheral isn't actually getting 48 MHz all bets are off.

MSI and PLLCLK can be output via MCO (PA8). Now PLLCLK is a different tap of the PLL, but you can figure the ratios of the Q vs R taps.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..