I want to, in essence, record a few hundred mS of audio (actually an analog accelerometer) at 3.6kHz then play it back.
Currently I can achieve a 7.2kHz rate by setting the ADC prescaler register value to 7 (the largest, slowest, value available on a ZX-24u) which yields 7200 samples per second from the ADC hardware; that's slow enough that code can spin and wait for each completion, and read and store the result without missing a sample. To get 3.6kHz, I can deliberately ignore alternate samples, or average two.
Is there another method to achieve 3.6kHz-clocked ADC sampling?
ADC sampling rate
Re: ADC sampling rate
An ADC conversion can be triggered by the event system. It may be possible to configure an event to fire at the rate you want.GTBecker wrote:Is there another method to achieve 3.6kHz-clocked ADC sampling?
It may be simpler, however, to use WaitForInterval() in a separate task to read the previous conversion result and start a new conversion. Seven RTC ticks would yield a frequency of approximately 3.6KHz.
- Don Kinzer
ADC sampling rate
> ... Seven RTC ticks would yield a frequency of approximately 3.6KHz...
I don't follow. Isn't the RTC tick 512Hz?
I don't follow. Isn't the RTC tick 512Hz?
Tom
Re: ADC sampling rate
You're right, of course. Sorry for the confusion.GTBecker wrote:Isn't the RTC tick 512Hz?
You could set up a timer to generate an interrupt at a 3.6KHz rate and use the ISR to collect a sample and start the next conversion.
- Don Kinzer
ADC via DMA
Pushing the envelope, I'd like to explore high-speed ADC sampling using DMA to store results directly into a named var on a ZX-24u (ATxmega128a4U). A site search shows no DMA references.
Has anyone tried?
Has anyone tried?
Tom
Re: ADC via DMA
I haven't explored using DMA and I don't recall seeing any posts on the topic. A Google search using the terms xmega and DMA turned up several promising hits including an Atmel application note and an AVR Freaks thread that is exactly on point - capturing audio via the ADC and storing the samples in RAM using DMA.GTBecker wrote:Has anyone tried?
- Don Kinzer
I'd just printed the Atmel ADC and DMA app notes and the avrfreaks thread (http://www.avrfreaks.net/index.php?name ... 00&start=0), very promising, when you posted. Thanks.
Tom