I used STM32CubeMX version 4.22 to generate MSC usb device and modified it to have 2 custom bulk interfaces. I am using STM32F412, FS usb with internal Physical with maximum packet size of 64. Interface 0 has 2 BULK endpoints IN and OUT. Interface 1 have two alternate settings. Alt Setting 0 has 0 endpoints and Alt Setting 1 have 2 BULK endpoints IN and OUT.
Endpoints are defined as :
#define INTERFACE0_IN_EP 0x81
#define INTERFACE0_OUT_EP 0x01
#define INTERFACE1_IN_EP 0x82
#define INTERFACE1_OUT_EP 0x02
My device enumerates fine and Interface 0 works as expected. Host sends Set Interface 1, Alt Setting 1 request then i activate Interface 1 endpoints (0x82 and 0x02).
Interface 1 is not working as expected, i am sure it has something to do with my FIFO Settings. I get dataOut Call for INTERFACE1_OUT_EP but when i try to write INTERFACE1_IN_EP host only get 3 bytes back while i am writing 24 bytes. Immediately after this transaction i get CLEAR FEATURE request for interface 1 endpoints.
Here is my current FIFO Settings :
HAL_PCDEx_SetRxFiFo(&hpcd_USB_OTG_FS, 0xC0); //80
HAL_PCDEx_SetTxFiFo(&hpcd_USB_OTG_FS, 0, 0x40); //EP0
HAL_PCDEx_SetTxFiFo(&hpcd_USB_OTG_FS, 1, 0x80); //EP1
HAL_PCDEx_SetTxFiFo(&hpcd_USB_OTG_FS, 2, 0x40); //<-- If i don't add this line Host can not get any thing back, After adding this line host only receives 3 bytes on INTERFACE1_IN_EP.
Please help me to configure these FIFO settings properly so that second interface can also work as expected.