2015-01-21 01:34 AM
Hi
I'm a relative newbie in using ST or ARM devices, and I'm attempting to get a USB CDC device working using the VirtualCom example code, using an STM32L152 in a custom pcb.I'm using the Kickstart edition of IAR embedded workbench (is there a problem using this?)The main problem I'm having at the moment is that when I build my code and download it to the mcu, then plug the USB into my PC (64 bit Windows 7 Pro), I get a message on the PC ''USB device not recognized'', and the device appears in Device Manager with a yellow triangle named ''Unknown Device''.If I look in Device Manager at the ''Unknown Device'''s properties : they start as follows:Device Description : Unknown DeviceHardware IDs : USB\UNKNOWNOn our pcb, we've got an 8 MHz crystal clock on the HSEWhat I'm intending to do is to get the PLL producing 48MHz for the USB... and the fastest possible SYSCLK.HSE = 8 MHzPLLMUL = 6so PLLVCO = 6*8 = 48 MHzPLLDIV = 2soSYSCLK = 24 MHzAHB, APB1, & APB2 prescalers are all set to 1I've used RCC_GetClocksFreq() to get the configured clocks' frequencies and that tells me that the code thinks SYSCLK, HCLK, PCLK1 & PCLK2 are all 24 MHz. I therefore assume that USBCLK is correctly set to 48 MHz.I've tried setting MCOPRE to 1 and MCOSEL to output SYSCLK, and can measure 24.000 MHz on the MCO pin. so I know that seems to be working.Does anyone have any ideas what could be wrong please ? #cdc #usb2015-01-22 11:40 AM
Try to disable VBUS sensing.
hpcd_USB_OTG_HS.Init.vbus_sensing_enable = DISABLE;2015-01-23 04:00 AM
Unfortunately, I can find nothing about VBUS in the reference manual (RM0038) for the STM32L152xx device we're using.
(the part number on the chip is STM32L152RDT6)Our pcb does not have the vbus line connected (it's self powered)Searching the source coed (for the VirtualCom example and include files) there's no reference to vbus either, so if I try to addhpcd_USB_OTG_HS.Init.vbus_sensing_enable = DISABLE;
the code won't compile.
2015-01-28 09:22 AM
Problem solved.
There were 2 issues. One was on our own custom PCB (an unused chip was dragging the USB line down), the other was in the Clock Tree.Looking at the clock tree in document RM0038, which can be foundhttp://www.st.com/web/en/resource/technical/document/reference_manual/CD00240193.pdf
, on page 130, it was not clear that the PLL VCO is divided by 2 before its sent to the USB device.I also had to change the values of idVendor and idProduct in usb_dev_desc.c to match those in the inf file (driver), so I changed 0xFFFF, // idVendor 0x0048, // idProductto 0x0483, // idVendor 0x05740, // idProductNow I've put the clock tree code back as it was in the VirtualCom example, Windows sees the USB driver and I can move forward with my project.