cancel
Showing results for 
Search instead for 
Did you mean: 

stm32wl55jc adjust adc dma sample rate for microphone

AHakk.1
Associate III

I am using stm32wl55jc1. I want to use accelerometer at 50khz and microphone at 2khz (2048). I am trying to make fft. With pooling adc method, I can do that easily. with 500 micro second delay.

for(int i=0;i<128;i++)
{
microSecond=micros();
HAL_ADC_PollForConversion(&hadc,1);
readValue = HAL_ADC_GetValue(&hadc);
data[i] = readValue;
delay_us(500+microSecond);
}
FFT(data,128,2000);

I shouldn't blok the cpu so I need to use dma. 

Sampling Time: 16 ADC clock cycle((12.5+1.5)*1/24MHz=0.58333µs)

here is my adjustment of adc:


_legacyfs_online_stmicro_images_0693W00000bk3qPQAQ.pnghere is my code:

uint32_t ADC_VAL[128];
 
void HAL_ADC_ConvCpltCallback(ADC_HandleTypeDef* hadc)
 
{
 
FFT(ADC_VAL,128,2048);
 
}
 
HAL_ADC_Start_DMA(&hadc,ADC_VAL,128);

As I said before, I can use fft without problem with pooling and timer. I am writing 0.5 mikrosecond delay and thats it. I want to use dma but I couldn't manage it. How can I adjust sample rate with dma ? and if I do that, can I use accelerometer and microphone with out blocking each other ?

0 REPLIES 0