2016-07-07 08:08 AM
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.
2016-07-12 04:30 AM
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 . 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 Check also that needed 48MHz USB clock is provided (HSE is there ). -Hannibal-2016-07-12 04:06 PM
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.2016-07-12 05:16 PM
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.