Understanding USB FIFO configuration in the CDC example
Hi,
I am trying to wrap my head around the correct configuration of the USB FIFOs in USBD_LL_Init().
As far as I understand you need the RX FIFO and one TX FIFO per endpoint .
Lets look at the HID example. There are two endpoints, EP0 + EP1 (the HID).
#define HID_EPIN_ADDR 0x81UThe FIFO config for FS in USBD_LL_Init() looks like this:
HAL_PCDEx_SetRxFiFo(&hpcd_USB_OTG_FS, 0x80);
HAL_PCDEx_SetTxFiFo(&hpcd_USB_OTG_FS, 0, 0x40);
HAL_PCDEx_SetTxFiFo(&hpcd_USB_OTG_FS, 1, 0x80);I take it that the first SetTxFiFo is for EP0 and the second SetTxFiFo is for EP1. Makes sense to me.
Now let look at the CDC example. There are three endpoints, EP0 + EP1 (CDC data) + EP2 (CDC command).
#define CDC_IN_EP 0x81U /* EP1 for data IN */
#define CDC_OUT_EP 0x01U /* EP1 for data OUT */
#define CDC_CMD_EP 0x82U /* EP2 for CDC commands */However, the FIFO config for FS in USBD_LL_Init() is exactly the same as for the HID:
HAL_PCDEx_SetRxFiFo(&hpcd_USB_OTG_FS, 0x80);
HAL_PCDEx_SetTxFiFo(&hpcd_USB_OTG_FS, 0, 0x40);
HAL_PCDEx_SetTxFiFo(&hpcd_USB_OTG_FS, 1, 0x80);How can the CDC example even work, when there are three endpoints, but only two TX FIFOs?
