2018-06-15 02:45 AM
hello,
I'm trying to implement a USB microphone using STM32L4 discovery board.
I have started with the USB device example and now trying to add the microphone.The library have given us the stm32l476g_discovery_audio.c
with the following functions
- BSP_AUDIO_IN_Init(SAI_AUDIO_FREQUENCY_48K,16,1)
- BSP_AUDIO_IN_Record(RecBuff,2048);
both returned AUDIO_OK but nothing is written to the
RecBuff.. Is there a know problem with these fuctions?
socondly, how can we add USB clock config to the PeriphClockSelection?
The given code in
stm32l476g_discovery_audio.c in AUDIO_SAIPLLConfig does the following// SAI clock config//
//PLLSAI1_VCO= 8 Mhz * PLLSAI1N = 8 * 43 = VCO_344M////SAI_CK_x = PLLSAI1_VCO/PLLSAI1P = 344/7 = 49.142 Mhz // RCC_ExCLKInitStruct.PeriphClockSelection = RCC_PERIPHCLK_SAI1; RCC_ExCLKInitStruct.PLLSAI1.PLLSAI1N = 43; RCC_ExCLKInitStruct.PLLSAI1.PLLSAI1P = 7; RCC_ExCLKInitStruct.PLLSAI1.PLLSAI1ClockOut = RCC_PLLSAI1_SAI1CLK;I have tried this, not sure if it's a proper solution
RCC_ExCLKInitStruct.PeriphClockSelection = RCC_PERIPHCLK_USB | RCC_PERIPHCLK_SAI1;
RCC_ExCLKInitStruct.PLLSAI1.PLLSAI1N = 43; RCC_ExCLKInitStruct.PLLSAI1.PLLSAI1P = 7; RCC_ExCLKInitStruct.PLLSAI1.PLLSAI1ClockOut = RCC_PLLSAI1_SAI1CLK; RCC_ExCLKInitStruct.Sai1ClockSelection = RCC_SAI1CLKSOURCE_PLLSAI1; RCC_ExCLKInitStruct.UsbClockSelection = RCC_USBCLKSOURCE_MSI;