Hi
I have LPC54608 Dev Board and implementing USB async Audio device using SDK v2.2.0
Device have 2 audio streaming interfaces, one for playback, second for recording from line in of board
If I play music from PC everything seems to work fine for hours.
But when I enable recording interface(start recording on PC side), after ~20-300 seconds music playback stops.
I am debugging this problem currently, but your advises may be helpful.
Here is what I have found for now:
if (audioHandle->streamOutPipeBusy){
return kStatus_USB_Busy;}
isBusy also set in:
deviceHandle->endpointCallback[(uint8_t)((uint32_t)endpoint << 1U) | direction].isBusy
#define USB_DEVICE_IP3511_DOUBLE_BUFFER_ENABLE (0u)
To sum up, everything works like sometime I miss call to USB_DeviceAudioRecv, but as can be seen by busy states it is always called as it should. I think as problem somewhere in USB stack, as when double buffering enabled there is added interrupt disabling and re-enabling when buffer switching made.
Hope for your advices
Thank you!
After further dubugging I have found that when EP stuck lpc3511IpState->epCommandStatusList of isochronous OUT EP doesn't have "Active" bit set. Nor buffer 1, nor buffer 2. That's why interrupts are not generated anymore. Another question how stack falled to this state. Because HW should generate interrupt, once it clears "A" bit. I have a strong filling that it is related to interrupt disabling and re-enabling inUSB_DeviceLpc3511IpTransaction with double buffering enabled.
static usb_status_t USB_DeviceLpc3511IpTransaction(usb_device_lpc3511ip_state_struct_t *lpc3511IpState,usb_device_lpc3511ip_endpoint_state_struct_t *epState,uint8_t endpointIndex){usb_status_t status = kStatus_USB_Error;/* 1. transfer size is 0; 2. All are primed */if ((epState->transferLength <= epState->transferPrimedLength) && (epState->transferLength != 0)){
return kStatus_USB_Success;}
#if (defined USB_DEVICE_IP3511_DOUBLE_BUFFER_ENABLE) && (USB_DEVICE_IP3511_DOUBLE_BUFFER_ENABLE)//NOTE: here may be problemuint32_t interruptMask;if ((endpointIndex >> 1U) != USB_CONTROL_ENDPOINT){
/* disable endpoint interrupts */interruptMask = lpc3511IpState->registerBase->INTEN;lpc3511IpState->registerBase->INTEN = 0;/* lpc3511IpState->registerBase->INTEN &= (uint32_t)(~(USB_LPC3511IP_MAX_PHY_ENDPOINT_MASK)); */do{
status = USB_DeviceLpc3511IpGetActualBufferAndPrime(lpc3511IpState, epState, endpointIndex, 1U);if (status != kStatus_USB_Success){
break;}
} while ((epState->transferLength > epState->transferPrimedLength) &&(epState->stateUnion.stateBitField.doubleBufferBusy < 2));/* enable endpoint interrupt again *//* lpc3511IpState->registerBase->INTEN |= (uint32_t)(USB_LPC3511IP_MAX_PHY_ENDPOINT_MASK); */lpc3511IpState->registerBase->INTEN = interruptMask;}
else#endif{
status = USB_DeviceLpc3511IpGetActualBufferAndPrime(lpc3511IpState, epState, endpointIndex, 0U);}
return status;}Any suggestions?
Finally I get know, that Interrupts disabling and reenabling causes this problem
interruptMask = lpc3511IpState->registerBase->INTEN;
lpc3511IpState->registerBase->INTEN = 0;
...
lpc3511IpState->registerBase->INTEN = interruptMask;
If enable this code for single buffer configuration it will also cause same problem.
For now I tried to remove this lines, as single buffering scheme does not use it, and my code worked without EP stuck for 2 hours.
Question to NXP