How to use ADC sensor with Ping Pong Application
Hello everyone, I am trying to read adc value from microphone. I am using FFT to get 100 Hz to 2 kHz or more to detect tone. In my project, I can use dma for get adc value and then I use DSP CMSIS. I can do this with my new workspace (with out anything only ADC-DMA) but when I try to implement this on Ping Pong Application I am struggling. I am beginner of stm32 and I can't find any video or blog about adding ADC sensor on stm32wl.
As I say, I did all of things but I can't add ADC pooling or ADC DMA method on Ping Pong Application. I try to add adc_if.c, adc_if.h, sys_app.c,sys_app.h but I couldn't manage it.
I found adc.c and I configure it for Pool method, I only made continous cov mode enable.
hadc.Init.ContinuousConvMode = ENABLE;and other files (adc.c etc.) I try to add these (I am using IN0 of ADC. So it is ADC_CHANNEL_0:
static uint32_t ADC_ReadMicData(uint32_t channel)
{
uint32_t ADCxConvertedValues = 0;
ADC_ChannelConfTypeDef sConfig = {0};
MX_ADC_Init();
/* Configure Regular Channel */
sConfig.Channel = ADC_CHANNEL_0;
sConfig.Rank = ADC_REGULAR_RANK_1;
sConfig.SamplingTime = ADC_SAMPLINGTIME_COMMON_1;
if (HAL_ADC_Start(&hadc) != HAL_OK)
{
/* Start Error */
Error_Handler();
}
/** Wait for end of conversion */
HAL_ADC_PollForConversion(&hadc, HAL_MAX_DELAY);
/** Wait for end of conversion */
ADCxConvertedValues = HAL_ADC_GetValue(&hadc);
return ADCxConvertedValues;
/* USER CODE BEGIN ADC_ReadChannels_2 */
/* USER CODE END ADC_ReadChannels_2 */
}I add my I2C sensor on my own but I couldn't find ADC for my Microphone.
Can you share me the way of adding any ADC sensor for Ping Pong Application ? or at least if there is any video or something, can you share with me please?