2025-02-26 10:52 PM
I have been struggling trying to implement two CDC-ACMs on a NUCLEO-U5A5ZJ board on the USB_OTG_HS bus and am having great difficulty. I have been successful getting them to appear on Device Manager, but I have been unsuccessful getting them to transmit data. It just locks up when I send data, with no error code or failure. I have found out how to do this using the FS USB, but there is no example or documentation for the HS_OTG HAL. Its as if it's missing a FIFO, and I think it has to do with the following section which has essentially no documentation:
VOID USBX_APP_Device_Init(VOID)
{
/* USER CODE BEGIN USB_Device_Init_PreTreatment_0 */
/* USER CODE END USB_Device_Init_PreTreatment_0 */
/* USB_OTG_HS init function */
MX_USB_OTG_HS_PCD_Init();
/* USER CODE BEGIN USB_Device_Init_PreTreatment_1 */
HAL_PCDEx_SetRxFiFo(&hpcd_USB_OTG_HS, 0x200);
HAL_PCDEx_SetTxFiFo(&hpcd_USB_OTG_HS, 0, USBD_MAX_EP0_SIZE/4);
HAL_PCDEx_SetTxFiFo(&hpcd_USB_OTG_HS, 1, USBD_CDCACM_EPIN_HS_MPS/4);
HAL_PCDEx_SetTxFiFo(&hpcd_USB_OTG_HS, 2, USBD_CDCACM_EPINCMD_HS_MPS/4);
/* USER CODE END USB_Device_Init_PreTreatment_1 */
/* initialize the device controller driver*/
_ux_dcd_stm32_initialize((ULONG)USB_OTG_HS, (ULONG)&hpcd_USB_OTG_HS);
/* USER CODE BEGIN USB_Device_Init_PostTreatment */
/* USER CODE END USB_Device_Init_PostTreatment */
}