USB Host Audio MIC Device Input - incomplete code
Dear STM Team,
dear STM Community,
please, who can help for intended project: "USB MIC Device on STM Board as USB Host Audio with Input Steaming"?
The code, provided in CubeHAL (drivers, STM USB Middleware) as well as the generated code by CubeMX tool seems to be incomplete:
How to extend the USBH (host) Audio Class for 'microphone' input streaming?
Which code where to add?
Issues:
- I have used CubeMX code generator for my board (NUCLEO-H745ZI-Q) with USB Host and Audio Class selected
- It generates code (properly), it is 'compile clean' but nothing works (on USB)
- OK, sure - it cannot: the generated code does not setup. does not enable any USB interrupt
- OK, I could manually add/fix the USB OTG Interrupt handler: now, the USB Enumeration for the USB MIC works, STM board requests properly the MIC device descriptors and generates (properly) the SOF signal (on GPIO pin), obviously to enable power for USB MIC properly
- it sets the right parameters in the USB Middleware driver (e.g. a 'microphone' as connected, 288 byte Endpoint size after MIC Enumeration etc.)
What is missing?
If I see the code, the audio data from MIC (every 1 ms an USB packet, via Endpoint 0x81) is not coming (no interrupts anymore, nothing stored in memory)
It cannot, because the code is missing!
The function 'USBH_AUDIO_InputSteam()' is empty (and optimized to do nothing, no code at all at the end).
So, I think, I had to add code to get IN, Input, EP 0x81 input data. If a Pipe for it is already configured (just not triggered) - I cannot say right now (but the EP 0x81 seems to be known by the driver).
Even, I do not know (sorry):
- is there a need to send a command from STM Host to MIC Device in order to trigger that MIC will send an USB packet with Audio data (288 bytes for 2 channels, 24bit, 48 KHz in my case)?
- Can I place a function call in the SOF generator function (every 1 ms) in order to receive anything from the USB MIC Device (or anywhere else - where)?
- Do I have to use a (HW) Pipe as well? Is this Pipe already setup (just not kicked off)? Where will be the data in memory and how to access this USB packet/frame? (assuming USB DMA is involved - a need for cache coherency operations?) Is there a need to enable additional USB OTG (Endpoint) interrupts?
- How to trigger an InputStream function, how to know if received and where the MIC Device data is stored? (ready to process it?)
I think, this STM USB Host Audio Class for a MIC Input was never implemented (never tested and never used- sorry). It should be missing on all STM boards and projects (USB Middleware). The counterpart, the 'headphone' Host Audio Class, seems to be complete, just the opposite direction looks like never used and never implemented (sorry).
Please, how to extend the code to bring-up an USB MIC Device on an STM board with STM USB Middleware as USB Host Audio Class Input device?
Thank you.
Best regards
Torsten
