cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F105RC USB Device not detected

hckar
Associate II

Hello.  I have a custom board with F105RCT7. The summary of my problem is the USB interface is not working at all. The computer does not detect anyting. The board is configured as a VCP device. I have a Nucleo-H743ZI-2 board and done some tests with. Now I am doing the exact same tests with my custom board. The fact is that I coppied the USB interface from the schematics of the nucleo board. But later I discovered that there are some differencences between CM7 and CM3 MCUs in terms of HW design. I am sending an SS of the related part of the design. Configuring the MCU as a VPC and transmitting messages over the USB takes only a couple of seconds when you configure everyting in CUBEMX. So I am sure that there is a HW problem. I always worked with CM4 and CM7 MCUs. Even though CM3 is simpler, it is the first time I use it.

In the design D+, D- and Vbus pins are corectly connected to the MCU. When I connect the cable, the LED lights up. The board is powered from the USB (so it  is not self powered) and I can flash the MCU, see debug messages over SWO, generate PWMs etc. The voltage levels are correct. I don't observe any fluctuations. Most probably I did a design error. I had to connect pins 1,3 to the MCU and 5,6 to the connector. I corrected this error on the board that I am working on it. As far as I understand from AN4879 I don't need to have a pull up resistor connected to D+ if the MCU is F105 or F107. But I tried this as well. Before correcting the direction of the EMI filter, I connected a 1.5K pull up resistor to the MCU side of the filter on another board. In that case the computer detected something but it threw "failed to get device descriptor" error. I did not try the same on the board that I corrected the EMI filter direction.

USB stack is so hard to debug. I correctly run my basic USB transmission example on the nucleo board. I trust the drivers provided from STM. And focused on the HW. Thanks for any help.

hckar_0-1747988544280.pngCattura.PNG

 

1 ACCEPTED SOLUTION

Accepted Solutions
STOne-32
ST Employee

Dear @hckar ,

 Here are my recommendation for testing purposes :

 

1) Check your HSE - Main oscillator on board versus the right PLL configuration for the embedded USB PHY . You can see our reference codes at GitHub 

 

2) Check PA9 direct connection to VBUS without the resistors bridge for testing purposes - from connector to the PA9 pin .

 

Here is a schematics from our first Evaluation Board for this MCU - STM32F1 Connectivity Line ( see only bottom part - as it is working in OTG mode with Host ) but in your case only device is required ) to check the ID line also if it necessary?

 

IMG_3221.jpeg

Hope it is helping You .

STOne-32

View solution in original post

5 REPLIES 5
STOne-32
ST Employee

Dear @hckar ,

 Here are my recommendation for testing purposes :

 

1) Check your HSE - Main oscillator on board versus the right PLL configuration for the embedded USB PHY . You can see our reference codes at GitHub 

 

2) Check PA9 direct connection to VBUS without the resistors bridge for testing purposes - from connector to the PA9 pin .

 

Here is a schematics from our first Evaluation Board for this MCU - STM32F1 Connectivity Line ( see only bottom part - as it is working in OTG mode with Host ) but in your case only device is required ) to check the ID line also if it necessary?

 

IMG_3221.jpeg

Hope it is helping You .

STOne-32

Hello. Thank you the reply. I discovered the problem inspiring from your reply @STOne-32 . It is the Vbus line. I enabled Vbus sensing in the configurations. And 3V3 in this line drops to 800 mV during the execution of MX_USB_DEVICE_Init();. In particular after the execution of this line: 

  /* Enable HW VBUS sensing */
  USBx->GCCFG |= USB_OTG_GCCFG_VBUSBSEN;

in stm32f1xx_ll_usb.c.

Now I am curious about how do i have to change my settings. The device is bus powered. In some other online sources I have read that the Vbus sensing must always be enabled. For now my device is bus powered. But it is only for the tests. It will not be bus powered in normal operating conditions and the USB cable might be attached at any time. So i need to sense the existance of Vbus. But why the voltage in PA9 drops to almost zero as soon as Vbus sensing is enabled while configuring the peripheral? I dont get if this is caused by a design error in electronics or the configurations are not correct.

STOne-32
ST Employee

Dear @hckar ,

Thank you for the follow-up, regarding the voltage drop you are experiencing on PA9 when VBUS sensing is enabled could be related to the internal current consumption of the VBUS sensing block.

When VBUS sensing is enabled, PA9 should be left in its default state (floating input), not as an alternate function. The internal sensing block can consume around 200 µA, which might be causing the voltage drop. if you can check it at software level, please?

Then may be to have a voltage divider to reduce the current as in this  Knowledge Article : Management of VBUS sensing for USB device design - STMicroelectronics Community 

If you are using the internal bootloader also, we have an Errata on this Topic : STM32 microcontroller system memory boot mode - Application note - Section "19.3.4 PA9 excessive power consumption when USB cable is plugged
in bootloader V2.0"

 

Let me know if it helps you.

STOne-32.

Hello and thank you for fast reply @STOne-32 . I followed the instructions in the link you shared and replaced the voltage divider resistors with 10K and 4.7K ones. This solved my problem. Simply 220K and 330K were too high. For the revision I consider putting a very low cost LDO instead of using a voltage divider. There are LDOs cost as less as a resistor.

Great to see dear @hckar  you fixed it ! well done.