2016-01-05 04:49 AM
When preparing to receive the data on OUT isochronous endpoint, the HAL sets up the even/odd flag once when you call the PrepareReceive for that specific frame that is active at that moment.
However the data may come on other odd/even frame than was expected and thus the first transfer will be lost 50% of the time.In the EOPF interrupt the odd/even flag needs to be updated for all active endpoints.The EOPF should also be unmasked in init section as well.This change to HAL_PCD_IRQHandler is working for me:if(__HAL_PCD_GET_FLAG(hpcd, USB_OTG_GINTSTS_EOPF)) { /* End of frame */ uint8_t i; for(i = 0; i < 16; i++) { ep = &hpcd->OUT_ep[i]; // Check if there are enabled endpoints if((USBx_OUTEP(ep->num)->DOEPCTL & USB_OTG_DOEPCTL_EPENA) == USB_OTG_DOEPCTL_EPENA) { if ((ep->type & EP_TYPE_ISOC) == EP_TYPE_ISOC) { if ((USBx_DEVICE->DSTS & ( 1 << 8 )) == 0) { USBx_OUTEP(ep->num)->DOEPCTL |= USB_OTG_DOEPCTL_SODDFRM; } else { USBx_OUTEP(ep->num)->DOEPCTL |= USB_OTG_DOEPCTL_SD0PID_SEVNFRM; } } } } __HAL_PCD_CLEAR_FLAG(hpcd, USB_OTG_GINTSTS_EOPF); }2016-01-05 04:54 AM
Also in the rest of HAL code, the check for isochronous should be changed to & from strict ==.
This is because there are additional bits for isochronous endpoints and the attribute might be not 0x01 all the time.
For example audio isochronous endpoint with feedback is 0x05 but still it is isochronous.
Proposed check is:
if ((ep->type & EP_TYPE_ISOC) == EP_TYPE_ISOC)