cancel
Showing results for 
Search instead for 
Did you mean: 

How to make the default STM32Cube USB device library run as microphone?

THe1
Associate

Hello everyone,

I want to make an USB microphone using the STM32CubeIDE. After I configured the USB connection with STM32CubeMX, I wanted to modify the USB device library to make it work in the other direction (from device to host). Therefore I modified the descriptors and the functions USBD_AUDIO_Init and USBD_AUDIO_DataIn.

When I plug the MCU into my PC, it is correctly recognized as USB microphone, so the descriptors are alright I guess. But it is not possible to record the generated audio samples from the MCU with e.g. Audacity.

So the basic problem is the isochronous data transfer. Then I recorded the USB connection with Wireshark and I figured out that the MCU answers the requests from the host but there are no audio data in the response. I tried to debug the code and I also figured out that the USBD_AUDIO_DataIn function is not called, so the endpoint number seems to be always 0.

So basically I have two questions:

Why is the endpoint number always 0 and the USBD_AUDIO_DataIn are not called?

What is necessary to let the USB device library work in the other direction (as microphone)?

Thank you for helping.

0 REPLIES 0