Skip to main content
cwwk
Associate
March 16, 2022
Solved

ADC setting for audio input

  • March 16, 2022
  • 2 replies
  • 1818 views

I am trying to create a simple guitar tuner using FFT but currently I am stuck at getting the correct ADC value.

When I tried passing 10Hz sine wave into my MCU, this is what I got from CubeMonitor which looks fine to me.

0693W00000KcnM2QAJ.png This is the graph from the value I got from IDE after pausing in debug which looks nothing like result from CubeMonitor.

0693W00000KcnPzQAJ.png 

I am currently using the STM32F411E-DISCOVERY and my current ADC setting is as below

0693W00000KcnTXQAZ.png0693W00000KcnQUQAZ.png 

I can't figure out where went wrong.

I'm still new to MCU and stuff so any help is much appreciated :)

This topic has been closed for replies.
Best answer by stephane.legargeant

Hello

Looking at CubeMonitor chart, it seems that value in adc_buf[0] is updated with all values. In the IDE view, the result in the buffer is strange. I guess you want to store the samples in the adc_buf array ? In this case, we should no see the nice curve in cubeMonitor when looking only adc_buf[0],

May be only the adc_buf[0] is udpated ? You should try to check other values (ie adc_buf[1] ) with cube monitor. It could be an issue in the DMA / ADC configuration : MThe number of sample to transfer for DMA may be not correct or ???. Checking the rest of the buffer with CubeMonitor can help.

Best regards

Stephane

2 replies

stephane.legargeant
ST Employee
April 14, 2022

Hello

Looking at CubeMonitor chart, it seems that value in adc_buf[0] is updated with all values. In the IDE view, the result in the buffer is strange. I guess you want to store the samples in the adc_buf array ? In this case, we should no see the nice curve in cubeMonitor when looking only adc_buf[0],

May be only the adc_buf[0] is udpated ? You should try to check other values (ie adc_buf[1] ) with cube monitor. It could be an issue in the DMA / ADC configuration : MThe number of sample to transfer for DMA may be not correct or ???. Checking the rest of the buffer with CubeMonitor can help.

Best regards

Stephane

cwwk
cwwkAuthor
Associate
April 21, 2022

Thanks. It seems that lowering the ADC speed solves the issue.