How to set an accurate ADC sampling rate!

Depending on the manufacturing batch your uc comes from, there is a good chance that you'll have to calibrate the ADC peripheral for decent results. Atmel Application Note Analog-to-Digital Converter in the SAM3S4 details everything you need to make this calibration.
In order to get better results from this peripheral, these rules may apply:
*For conversion of periodic signals, add an RC filter with an RC time constant at least 10 times the frequency of the input signal,
*Select an ADC channel dedicated as a purging input. Connect it to ground through a small resistor (say 100 ohms) and sample that channel in between each channel you are interested in. This ensures that the ADC channel of interest is purged of residual charges between readings. The resistor is important to reduce current flow, but you want it small enough that the capacitor discharges in a reasonable time,
*Oversample and average as much as possible in regard to the sampling frequency you need, the number of enabled ADC channels and the maximum sampling frequency allowed,
*Power the board throughout the jack because the power supply from the USB cable might be very unstable,
*In case you have white noise at the ADC input (usually the case), you can improve 12-bit conversions into 16-bit conversions (see above Atmel Application Note).
*Using a PDC DMA gives you more time to apply results of calibration to a previous buffer of conversions while in parallel another buffer of conversions is filled by the DMA.

1 Like