2021-02-19 07:42 AM
Hi ST Geniuses
So, for quite a while I have been trying to create an USB audio mic. Problem is: it is quite hard and not always a complete solution.
And the X-CUBE-USB-AUDIO offers the complete solution, for audio and playback, even with feedback.
The problem is: it is so complicated to detach the USB solution from the nodes, and sessions thing (see here if you don't know what I am talking about USB device audio streaming Expansion Package for STM32Cube - User manual). And the middleware isn't the same generated by CubeMX, which makes it harder to port it to another microcontroller (in my case the STM32L4R9)
So, did anyone manage to do this? Or to approach this problem in another manner?
I also tried TinyUSB, which does not offer native support for the STM32L4 family nor it is fully tested for audio (isochronous).
Thanks for the help,
Gabriel.
2021-02-19 07:45 AM
It has been 2 years since this question : STM32F4 Cube-based USB Device Microphone in Audio Class streaming to Host PC was asked. I want to believe that someone has figured it out
2021-02-19 08:16 AM
it actually started 4 years ago!
I guess the conclusion must be that it's not a priority for ST.
Presumably, commercial products doing this sort of thing are using dedicated chips rather than general-purpose microcontrollers?
2021-02-19 09:24 AM
Definitely not a priority. There are IC's that do I2S <-> USB, just not available from ST. Weird from them...
And I'm stuck in a limbo where I have half my code working, a custom board that I made, and I don't wanna start over...
2021-02-27 12:15 PM
That topic actually it started not 2 or 4, but 6 years ago... Honestly ST doesn't care about STM32 software. USB, Ethernet, lwIP, FatFS - nothing works. Even USART and till not long ago pin toggling!
As for TinyUSB, L4(+) is supported:
Audio class seems to be a work in progress. But, comparing ST and TinyUSB software progress... Probably this year TinyUSB will have usable audio class, while ST's stack will always be buggy, bloated, using malloc() and doing everything in ISR. You can even help them develop that audio class. :)
2021-03-01 02:12 AM
Damn, 6 years...
I got it semi working with the package I asked about... but really it shouldn't take that much work
TinyUSB is really a work in progress... isochronous transfers aren't that well tested apparently; and as for L4+ I asked hathach personally by mail and I got an answer not too long after. And looking at the branches he is the only one working on audio. Hope it does not take too long but I needed something for now
For others who can pay, there is also HCC stack (official ST partner); maybe that is why they don't give that much attention to the official package
2021-03-01 03:26 AM
"Honestly ST doesn't care about STM32 software"
That's a bit of a leap!
Clearly, ST (or any other chip manufacturer) can't provide full, ready-made solutions for every single possible application - that's your job as a developer.
2021-03-01 12:34 PM
Actually that is what I mean - they should provide a few decent libraries and examples, not a junk in million minor variations. But unfortunately they are doing exactly the opposite. The main driver library (HAL) is a terribly buggy bloatware with a so limited API that it is completely useless. At the same time they are providing a trivial and broken examples in literally almost 100 (for UART) minor modifications across all series. It's a complete waste of resources. In reality a few decent examples for one or few functionally different MCUs would be actually educational and useful. They even have an employee, who already privately have shown how it should be done:
https://github.com/MaJerle/stm32-usart-uart-dma-rx-tx
One actually useful example, proper explanation and a few MCUs! The result - it obliterates those 100 useless official examples of how not to develop software. And it doesn't use HAL exactly because it is broken and useless...
2021-03-02 03:36 AM
I'm also helping someone else with the same problem, posting here if anyone needs : Having problem setting up USB Audio(Microphone) for STM32H743
Okay, so, once you change the USB descriptors make sure you uninstall your device on windows, and then plug it in again... Windows does not recognize a USB device with the same VID and PID if it has changed the descriptors (the same is not true on Linux, for example).
I had more luck using the X-CUBE-USB-AUDIO package, altough it is not cube-compatible. My mic works much better (it is not 100% tough). What you need to do is:
And then, you configure as your application should run :
Tell me if you have any questions, and good luck ! If you can make it work 100% (or at least 90) please post your updates.
Regards