cancel
Showing results for 
Search instead for 
Did you mean: 

NUCLEO-U083RC USB Device problem

marco_virg83
Associate II

Hello,

i'm developing an application using STM32U083 where i need to use USB CDC class. 

My demo is based on NUCLEO-U083RC board with STM32CubeIDE 1.15.1; i mounted an external USB-B connector on PA11/PA12 pins. I would like to use USB-X firmware stack; i used it in standalone mode on an old STM32L476G-DISCO board and it works fine.

I've followed the @B.Montanari guide and it was very clear.

With STM32U083 i have an issue...my host pc cannot recognize device but with any error. it seems to be totally disconnected, there is any activity and the microcontroller not trigger any interrupt on USB module so i think the USBX stack cannot work.

I checked with oscilloscope DP/DM but i see that the lines are both low, it seems the micro doesn't pulling up DP line and it explains why the host doesn't start any transaction.

Furthermore, if i solder a 1.5K external pullup resistor on PA12 -> 3.3V the host start enumerating but then fails but in this case the firmware doesn't trigger any usb-related interrupt too. 

I'm not sure if i have to do something (and how to if yes) on VBUS detection; i have on PA10 pin a voltage divider from +5 VBUS on the connector but i'm not sure on what to do here (pulling up D+ for example or trigger a reset).

The HAL/USBX stack launch the device usb-phy at last this way

 

 

 

 

/* Enabling DP Pull-UP bit to Connect internal PU resistor on USB DP line */
  USBx->BCDR |= USB_BCDR_DPPU;

 

 

 

 

I see in datasheet that this enable pull up on D+ pin but i cannot see any voltage on this PA12. 

In addition, in the STM32L476G-DISCO firmware the GPIO pins are configured as Alternate Function 10 but in the STM32U083 are not configured at all (perhaps it is not needed for this micro).

Could anyone help me? 

Thanks and sorry for my english

 

1 ACCEPTED SOLUTION

Accepted Solutions
marco_virg83
Associate II

I've solved by myself...

I think it is a lack of configuration on STM32Ide.

The USB peripheral was not powered on by the autoconfiguration tool; i've searched on datasheet about powering peripheral and simple adding 

HAL_PWREx_EnableVddUSB();

And everything worked like a charm.

I don't know why the HAL routines by default not power this device, perhaps it is a bug in the code generator.

 

Hope it helps

View solution in original post

8 REPLIES 8
marco_virg83
Associate II

I've solved by myself...

I think it is a lack of configuration on STM32Ide.

The USB peripheral was not powered on by the autoconfiguration tool; i've searched on datasheet about powering peripheral and simple adding 

HAL_PWREx_EnableVddUSB();

And everything worked like a charm.

I don't know why the HAL routines by default not power this device, perhaps it is a bug in the code generator.

 

Hope it helps

FBL
ST Employee

Hi @marco_virg83 

Thank you for your feedback.

An internal ticket is submitted to fix this issue 184680. 

 

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.


I'm out of offce with limited access to my emails.
Happy New Year!

Hi,

I have the same problem but adding this line does not help (HAL_PWREX_EnableVddUSB()).  Where exactly did you add this line to?

Basically the host computer does not enumerate the device and there is no error at all.

Thanks

Hi,

Which version is this fix on? I am using 1.16.0.

Thanks

Hi @dinhnguyen 

I've added the powering API HAL_PWREX_EnableVddUSB() in the HAL USB configuration; but it should not really matter where you put it 'cause the stack and the peripheral is fully working; the API should only work about the powering on the VBUS pin so the D+/D- will be pulled up correctly.

Tomorrow i will check on my code the position and i will post the code snippet.

Sorry to bother you again.  It would be great if you list the name of the file that you add this command to.  I try several files but it still does not work.

Hello @dinhnguyen 

this is my USB initialization function, here you can see where i added the USB powering on function.

void MX_USB_PCD_Init(void)
{

  /* USER CODE BEGIN USB_Init 0 */
	HAL_PWREx_EnableVddUSB();
  /* USER CODE END USB_Init 0 */

  /* USER CODE BEGIN USB_Init 1 */

  /* USER CODE END USB_Init 1 */
  hpcd_USB_DRD_FS.Instance = USB_DRD_FS;
  hpcd_USB_DRD_FS.Init.dev_endpoints = 8;
  hpcd_USB_DRD_FS.Init.speed = USBD_FS_SPEED;
  hpcd_USB_DRD_FS.Init.phy_itface = PCD_PHY_EMBEDDED;
  hpcd_USB_DRD_FS.Init.Sof_enable = DISABLE;
  hpcd_USB_DRD_FS.Init.low_power_enable = DISABLE;
  hpcd_USB_DRD_FS.Init.lpm_enable = DISABLE;
  hpcd_USB_DRD_FS.Init.battery_charging_enable = DISABLE;
  if (HAL_PCD_Init(&hpcd_USB_DRD_FS) != HAL_OK)
  {
    Error_Handler();
  }
  /* USER CODE BEGIN USB_Init 2 */

  /* USER CODE END USB_Init 2 */

}

 Let me know if you have any problem.

Best regards

Hi @marco_virg83,

Thank you for the details.  I now pass this point and run into another problem.  The host cannot read USB descriptive and reports  "USB descriptor error".  Another post shows that this is also related to VDDUSB but I can't figure it out yet.  Will dig into this.