2023-01-08 05:33 AM
Hi, I spend a lot of days trying to undestanding Microphones_streaming from X-CUBE-MEMSMIC1. That is very complex example and brillant at the same time. I want to extract the part for usb audio in streaming (device to pc), but it is a little crazy. it is important for me obtain a basic project for sending a randowm buffer. Then I want to create a support pack for ioc. Was some one able to generate a functional project only with this part? I ak for help to support but i can not be able to make with these indications. Thanks for your time
2023-01-24 08:12 AM
Hi @Tomás Cabeza ,
I'm not sure I got your point: do you need an example that sends random data instead of microphone ones?
If so, you can just simply pass your "random buffer" to the Send_Audio_to_USB function called into AudioProcess.
Something like this:
void AudioProcess(void)
{
if (CCA02M2_AUDIO_IN_PDMToPCM(CCA02M2_AUDIO_INSTANCE, (uint16_t *)PDM_Buffer, PCM_Buffer) != BSP_ERROR_NONE)
{
Error_Handler();
}
Send_Audio_to_USB((int16_t *)your_random_buffer, (AUDIO_IN_SAMPLING_FREQUENCY / 1000)*AUDIO_IN_CHANNELS * N_MS);
}
X-CUBE-MEMSMIC1 is not supported in CubeMX.
The microphone sampling frequency directly depends from the clock tree. Those values are strictly defined into the BSP_AUDIO file.
As for now, CubeMX is not able to read BSP files and import a bounded clock tree.
That's why we can't distribute MEMSMIC1 as a pack and there is no .ioc available.
I wish my answer can help you.
Feel free to further comment to find a proper solution for your use case.
Best regards