2024-12-25 05:36 PM
Hello, while testing the STM32Cube Ux_Device_* examples for STM32C071, I have encountered an issue of them not properly finishing USB enumeration. For example, both Ux_Device_HID and Ux_Device_HID_Standalone stall after the configuration descriptor phase (data from Wireshark):
167 14.656560 host 1.255.0 USB 36 GET DESCRIPTOR Request DEVICE
168 14.656844 1.255.0 host USB 46 GET DESCRIPTOR Response DEVICE
169 14.656879 host 1.255.0 USB 36 GET DESCRIPTOR Request CONFIGURATION
170 14.657134 1.255.0 host USB 37 GET DESCRIPTOR Response CONFIGURATION
171 14.657158 host 1.255.0 USB 36 GET DESCRIPTOR Request CONFIGURATION
172 14.657420 1.255.0 host USB 62 GET DESCRIPTOR Response CONFIGURATION
173 14.657449 host 1.255.0 USB 36 SET CONFIGURATION Request
174 14.658090 1.255.0 host USB 28 SET CONFIGURATION Response
while the Ux_Device_CDC_ACM passes the enumeration properly:
9 38.457333 host 1.51.0 USB 36 GET DESCRIPTOR Request DEVICE
100 38.457651 1.51.0 host USB 46 GET DESCRIPTOR Response DEVICE
101 38.457700 host 1.51.0 USB 36 GET DESCRIPTOR Request CONFIGURATION
102 38.457897 1.51.0 host USB 37 GET DESCRIPTOR Response CONFIGURATION
103 38.457906 host 1.51.0 USB 36 GET DESCRIPTOR Request CONFIGURATION
104 38.458302 1.51.0 host USB 103 GET DESCRIPTOR Response CONFIGURATION
105 38.458336 host 1.51.0 USB 36 GET STATUS Request
106 38.458340 1.51.0 host USB 30 GET STATUS Response
107 38.458377 host 1.51.0 USB 36 GET DESCRIPTOR Request CONFIGURATION
108 38.458831 1.51.0 host USB 103 GET DESCRIPTOR Response CONFIGURATION
109 38.458895 host 1.51.0 USB 36 SET CONFIGURATION Request
110 38.459781 1.51.0 host USB 28 SET CONFIGURATION Response
111 38.459813 host 1.51.0 USB 36 SET INTERFACE Request
112 38.460230 1.51.0 host USB 28 SET INTERFACE Response
113 38.460339 host 1.51.0 USBCOM 36 GET LINE CODING Request
114 38.460532 1.51.0 host USBCOM 35 GET LINE CODING Response
115 38.460557 host 1.51.0 USBCOM 36 SET CONTROL LINE STATE Request
116 38.460686 1.51.0 host USB 28 URB_CONTROL out
117 38.460963 host 1.51.0 USBCOM 43 SET LINE CODING Request
118 38.461287 1.51.0 host USB 28 URB_CONTROL out
119 38.461338 host 1.51.0 USBCOM 36 GET LINE CODING Request
120 38.461516 1.51.0 host USBCOM 35 GET LINE CODING Response
There were no memory allocation errors throughout MX_USBX_Device_Init(), and I left USBX_APP_Device_Init() body untouched (Ux_Device_HID example, app_usbx_device.c):
/* USER CODE BEGIN USB_Device_Init_PreTreatment_0 */
/* USER CODE END USB_Device_Init_PreTreatment_0 */
/* USB_DRD_FS init function */
MX_USB_PCD_Init();
/* USER CODE BEGIN USB_Device_Init_PreTreatment_1 */
HAL_PCDEx_PMAConfig(&hpcd_USB_DRD_FS, 0x00, PCD_SNG_BUF, 0x0C);
HAL_PCDEx_PMAConfig(&hpcd_USB_DRD_FS, 0x80, PCD_SNG_BUF, 0x4C);
HAL_PCDEx_PMAConfig(&hpcd_USB_DRD_FS, USBD_HID_MOUSE_EPIN_ADDR, PCD_SNG_BUF, 0x8C);
/* USER CODE END USB_Device_Init_PreTreatment_1 */
/* Initialize the device controller driver*/
ux_dcd_stm32_initialize((ULONG)USB_DRD_FS, (ULONG)&hpcd_USB_DRD_FS);
/* USER CODE BEGIN USB_Device_Init_PostTreatment */
/* Start the USB device */
HAL_PCD_Start(&hpcd_USB_DRD_FS);
/* USER CODE END USB_Device_Init_PostTreatment */
- after all, I was just testing the supposedly working example.
Any suggestions as to where I should start looking for the source of the problem?
Thank you, and happy holidays!