Resources for Direct ADC access

I have an audio acquisition library that runs on the Arduino Uno that makes heavy use of direct calls to the ATMega’s ADC. Does anyone have resources for convening that to run on the STM32F205? What is the best documentation on accessing that specifically for DSP usage?

The basic premise is a mic hooked up to a 3 stage op-amp. The MCU scan 3 ADC to find which one to pull from (if it is not full saturated) and then samples it, runs an FFT and a-weighting and returns a sound pressure level in dBa. I would love to get this working on the particle.


Sounds cool @MichaelRensing

This is a good app note:

And the reference manual:

The adc_hal.c

You can implement any of this directly in a user app as well to test things.

Thank you very much. This look like exactly what I was searching for.

1 Like

I am just now getting back to this, and have a couple of questions.

I noticed that in the reference RM0033 document, that the ADCCLK can be scaled. I am looking to sample around the 21kHz frequency of audio. To do this I should set the ADCCLK to fPCLK2/6 and then set the sample time to 480 cycles to give me ~20kHz. I am referencing the ADC_HAL file heavily, but didn’t see the fPCLK2 set anywhere. How can I go about setting that?

Also, in the the Library I am looking to port, I specify the number of samples to capture. It is somewhat limited due to the nature of the Atmel328 chip. I see that the ADC_HAL_READ function by default reads 10 samples and averages them and returns one value. Is this the noise cancelation? Is this the recommend way to capture data on the ADC? Or would a more accurate way to capture all the data and work with the individual samples? Just curious, I would like to take the best approach to create a sound level meter.