2017-10-05 01:41 AM
Good Morning!
I am currently developing an HS USB Audio DAC using the STM32f205 microcontroller, using the HAL Library to keep things simple and to have a fast code. I have already tested my USB 'low-level-driver' by sending bulk packets to an LibUSB application and this part (the enumeration, bulk transfers, etc.) works like a charm.
What im struggling with since weeks is getting isochronous transfers running. No matter what im doing, every time i tell windows 7 to test the audio-device i only get incomplete isochronous transfer interrupts, and the interrupts wont even stopp after closing the endpoint. Indeed i never got a single packet transfered, is it the OUT-Data endpoint or the IN-Feedback endpoint. Using Wireshark im seeing that windows is trying to send an receive data.
This is the part where i initialise and start the USB:
hpcd.Instance = USB_OTG_HS;
hpcd.Init.dev_endpoints = 4; hpcd.Init.use_dedicated_ep1 = 0; hpcd.Init.ep0_mps = DEP0CTL_MPS_64; hpcd.Init.dma_enable = 0; hpcd.Init.low_power_enable = 0; hpcd.Init.phy_itface = USB_OTG_ULPI_PHY; hpcd.Init.Sof_enable = 1; hpcd.Init.speed = USB_OTG_SPEED_HIGH; hpcd.Init.vbus_sensing_enable = 0;HAL_PCD_Init(&hpcd);
hpcd.pData=&pData;
pData.usb_adress=0;HAL_PCDEx_SetRxFiFo(&hpcd, 0x80);
HAL_PCDEx_SetTxFiFo(&hpcd, 0, 0x80); HAL_PCDEx_SetTxFiFo(&hpcd, 1, 0x80);HAL_PCD_Start(&hpcd);
With this im opening the isochronous endpoints:
HAL_PCD_EP_Open(hpcd, 0x01, MAX_PACKET, EP_TYPE_ISOC);
HAL_PCD_EP_Open(hpcd,0x81,4,EP_TYPE_ISOC);
And with this im starting a transfer:
HAL_PCD_EP_Receive(hpcd,0x01,pData.USB_Buf,MAX_PACKET); //uint8_t DMA_Buf[512];
HAL_PCD_EP_Transmit(hpcd,0x81,(uint8_t *)&(pData.feedback), 4); //uint32_t feedback;
i tried opening the EP and starting the transfer on:
- receiving the set interface setup request (which should indeed start the transfer)
- the EOPF interrupt after receiving the set interface setup request
- the SOF interrupt after receiving the request
- opening the EP on all these events and starting a transfer
additionally
on the Iso-Incomplete interruptsand maybe a couple of other things i forgot over the weeks. My first try was rewriting the stm32f205 evaluation board audio example from STM, which failed for the same reason (comparing the code from the example to mine, it does literally the same stuff, but through 3-4 more software-layers, which made it very hard to read). I also tried to debug the code by reading and comparing the hardware USB registers with the RM0033 reference manual, but i couldnt see anything off.
For reference, im using the CooCox IDE and the HAL-Library, version V1.2.1, date 14-April-2017.
Has anyone a piece of working code for the stm32f205 he could share with me, or did anyone every ran in a similiar problem and got a solution for this?
I know i have a rather confusing way to discribe things, so please aks for further details an explanaitions!
Many thanks in advance!