ADC Sample Rate

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderator: RoccoMarco

Post Reply
gnif
Posts: 8
Joined: Wed Jan 08, 2014 12:23 am

ADC Sample Rate

Post by gnif »

Hi,

I have started to use ChibiOS and find its design is excellent. Yesterday started to try to write some code to use the ADC. I wish to sample analogue audio at a specific sample rate, 48 to 96khz would be nice. The problem is that I do not know or understand how to configure the ADC to run at this sample rate, from what I can tell the ADC is just running in continuous mode performing DMA transfers into the supplied buffer as fast as it can.

My question is, Is there a way to slow down the ADC to the desired sample rate, or am I going about this completely wrong?
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: ADC Sample Rate

Post by Giovanni »

Hi,

There are two ways:
1) You can increase the sampling time for your channels in order to obtain *about* the rate you need.
2) You use an HW triggered mode for the ADC and a timer generating the trigger at the rate you need.

Both solutions require knowledge of the ADC registers in order to setup the ADCConversionGroup structure, the second one also requires setup of a timer. I recommend a careful read of the ADC section in the Reference Manual.

Giovanni
Post Reply