This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

M4 USB audio



Dear experts,

I'm trying to use USB audio on M4, taking usb_dev_audio on dk-lm3s9b96 as a reference.

However, after once USBAudioBufferOut  as below, there's is no USB0 interrupt generated and no call back (USBBufferCallback)

if(USBAudioBufferOut(g_pvAudioDevice,
(unsigned char *)g_sBuffer.pucFill,
AUDIO_PACKET_SIZE, USBBufferCallback) == 0)

so the USB is not recognized by PC. 

Anyone meet this kind of problems?

Thanks first!

wensan

  • Hello Wensan Chou,

    The usb_dev_audio example is setup to use I2S which is not available on our current LM4F parts. What part are you trying to port this example to?

  • Hi 

    I use dual SPI to replace I2S.

    However, the point is while I'm initializing USB and used USBAudioBufferOut to get RAW data by DMA, USB0's interrupt somehow stop.

    This issue is not related to I2S or SPI but USB0.

    Best regards

  • Hello Wensan Chou,

    I cut down the usb_dev_audio example and removed all I2S and Sound driver code and fixed up the vector table entries for non-existent blocks. It appears to enumerate on the host PC and complete USB initialization without any problems on an EK-LM4F232.

    You mention you used the 9B96 usb_dev_audio example as a reference. Did you setup the USB0 vector in the startup_xxx (file name toolchain specific) module for the new project?

  • Hello Mitch,

    Thanks for your help,

    Our board used "LM4F230H5QR", and stellarisWare 9107.

    Actually, USB audio interrupt handler is correctly placed in startup_xxx.

    Strange thing is, if I marked out "USBAudioBufferOut" not getting data, USB driver works fine. ( PC can recognized USB audio example and interrupt keep alive. ) Of course, I can't get any audio data.

    But If I didn't marked out that, somehow USB0 interrupt stopped.  

    I also add delay " SysCtlDelay(100000000);" before USBAudioBufferOut to do some test..  The longer delay I add, the interrupt keep alive longer.

    It maybe caused by DMA, but I check the DMA register and control table. it looks normal.

    By the way, our HW usd USB typeB as USB device, and Pin1 was connect to USB0_VBUS, Pin2 was connected to USB0_DM and Pin3 was connected to USB0_DP

    Pin4 is grounded. USB0_ID was pulled high, It's a little different to EK-board.

  • Hi Experts

    I found the USB device driver only response once URB_SELECT_INTERFACE,.

    If HOST try to send  URB_SELECT_INTERFACE, again, USB0 hang.

    Do you have any suggestion to debug this? 

  • Hello,

    I have faced same problem trying to implement USB audio example on a Stellaris Launchpad (lm4f120h5qr). If I comment out the call  to USBAudioBufferOut, then the device is properly recognized at the PC side, and I can play audio data through it (I can see in USB traffic analyzer that the audio data is being sent to the device and ACKed by the USB driver library), but the data never gets to my application code.

    As soon as I add the call to USBAudioBufferOut, the USB device stops working properly. It is still recognized by the host, however the logs at the host computer are flooded with "usb_set_interface failed (-ETIMEDOUT)" and the audio doesn't play. Looks like the device stops responding to USB requests from the host. However if I connect to the device using a debugger, then I can see that it's not hung, and is normally executing the main application loop.