TinyUSB + STM32CubeIDE + Nucleo L476VG PDM Microphone UAC2 Implmentation Guide #1502
umichxuwentao
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am implementing a PDM Microphone using STM32CubeIDE + Nucleo L476VG. It turns out that the middlewares provided by ST is not a good option after 1-2 weeks research and trail and error , so I turn to TinyUSB for help. It turns out that TinyUSB is much easier to use. I will update my experiences of implementing UAC2 using TinyUSB with STM32CubeIDE here after all the work is done.
Personal experiences:
2022.06.08
I am integrating TinyUSB into STM32CubeIDE from yerterday. It is way easier than my expectation. The example I am using is uac2_heaset. The posts I followed are #633 and #819. The post #126 tells me that L4 series is supported by the current dwc2 driver. Yerterday I ran into trouble and solved it according to #1436. The details of my configuration and problem could be found and answered by myself in #1499. Probably the legacy driver will be deleted in future commits and this problem will disappear.
2022.06.09
Most of the bugs that TinyUSB users would encounter are due to the users' configurations. I ran into trouble starting the isochronous transfer and solved it by changing my
tusb-config.h
macro definitions. Details will be included later.2022.06.10
The FIFO implementation in audio_device.h is so interesting! After a few trial and error, I find that picking a starting point from the microphone's PCM buffer and sending a single packet in preload callback will help. I will never lose data now______Hahaha, but this is joking, I am still losing one data per packet and I need to dig deeper into the FIFO formating setups. But, to be honest, TinyUSB is so easy to use!
2022.08.08
I was stuck in syncrhonization for a while and finally completed the PCB design/test. Now I have 1-channel 192kHz 24-bit/ 2-channel 192kHz 16-bit/ 4-channel 96kHz 16-bit configurations implemented. TinyUSB is great! There are a few restrictions by the hardware: 32-bit will not be possible because the nucleo DFSDM peripheral only supports up to 24-bit precision; 384kHz is not possible because the available best PDM microphones can run up to 4.8MHz and thus 384kHz will make the oversampling ratio 12.5, not an integer; 8-channel is not possible because DFSDM peripheral only supports 4 filter for regular conversion. I followed the uac2_heaset, audio_test and 4 microphone examples. They are more than helpful.
Beta Was this translation helpful? Give feedback.
All reactions