2024-07-11 12:50 AM
Hi everyone,
I am currently working on a project involving the STM32G0B1RE microcontroller and had encountered an issue while configuring the USB_DRD_FS (Dual Role Device Full Speed) in Device mode using STM32CubeIDE.
Here are the steps I followed:
After completing these configurations, I noticed that the GPIO pins associated with the USB_DRD_FS peripheral didn't appear in the generated code or usbd_conf.c
Best regards,
Sravani
2024-07-11 03:05 AM
Hi,
did you look in usbd_conf.c for : HAL_xx_MspInit( ...) ?
There it should be...
2024-07-11 04:50 AM
Am not getting GPIO pins, I get below code inside of PCD_MSP_Init,
RCC_PeriphCLKInitTypeDef PeriphClkInit = {0};
if(pcdHandle->Instance==USB_DRD_FS)
{
/* USER CODE BEGIN USB_DRD_FS_MspInit 0 */
/* USER CODE END USB_DRD_FS_MspInit 0 */
/** Initializes the peripherals clocks
*/
PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_USB;
PeriphClkInit.UsbClockSelection = RCC_USBCLKSOURCE_HSE;
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK)
{
Error_Handler();
}
/* Peripheral clock enable */
__HAL_RCC_USB_CLK_ENABLE();
/* Enable VDDUSB */
if(__HAL_RCC_PWR_IS_CLK_DISABLED())
{
__HAL_RCC_PWR_CLK_ENABLE();
HAL_PWREx_EnableVddUSB();
__HAL_RCC_PWR_CLK_DISABLE();
}
else
{
HAL_PWREx_EnableVddUSB();
}
/* Peripheral interrupt init */
HAL_NVIC_SetPriority(USB_UCPD1_2_IRQn, 0, 0);
HAL_NVIC_EnableIRQ(USB_UCPD1_2_IRQn);
/* USER CODE BEGIN USB_DRD_FS_MspInit 1 */
/* USER CODE END USB_DRD_FS_MspInit 1 */
2024-07-11 05:19 AM
Can you compile the project - or what errors you get ?
2024-07-11 10:50 PM
i get error: USB not recognized
2024-07-11 10:53 PM
AM follow the below link
https://shawnhymel.com/1795/getting-started-with-stm32-nucleo-usb-virtual-com-port/
2024-07-12 12:33 AM
Can you show i pic of the build - esp. the usb connection ?
2024-07-12 02:02 AM
2024-07-12 02:42 AM
Might work. :)
Sure about (2x green wire) DP+/- ? If puzzeled, it never works.
+
In Cube , setup: have you usb- PD enabled ? Disable, if you did.
2024-07-12 04:34 AM
> Am not getting GPIO pins
The USB pins can be set up in yet another .c file (msp...) - check all generated .c files.