Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sampling Frequency in DMA mode? #75

Closed
mh- opened this issue Mar 28, 2021 · 1 comment
Closed

Sampling Frequency in DMA mode? #75

mh- opened this issue Mar 28, 2021 · 1 comment

Comments

@mh-
Copy link

mh- commented Mar 28, 2021

From the adc_timer_dma` example, I get the impression that I should use

  adc->adc0->startTimer(3000); //frequency in Hz

to set the sampling frequency, is this assumption correct?

Unfortunately, I cannot make sense of the results I see at the moment, I was trying e.g. 300000 and 1000000 (300kHz, 1MHz), but did not see an increase of 3.3 in the number of samples for a reference waveform (although it did slightly increase).
Am I hitting some limit?
I'm using

    adc->adc0->setAveraging(4); // set number of averages
    adc->adc0->setResolution(12); // set bits of resolution

on a Teensy 4.0

Thanks
Michael

P.S.: When changing from 30000 to 60000, I get twice the amount of samples, as expected. But from 60000 to 120000 nothing visible happens.

@mh-
Copy link
Author

mh- commented Mar 28, 2021

I found

    adc->adc0->setConversionSpeed(ADC_CONVERSION_SPEED::VERY_HIGH_SPEED); // change the conversion speed
    adc->adc0->setSamplingSpeed(ADC_SAMPLING_SPEED::VERY_HIGH_SPEED); // change the sampling speed

in this post: https://forum.pjrc.com/threads/66679-ADC-with-sampling-rate-of-4Msps-with-Teensy?p=274408&viewfull=1#post274408

...and it helps a lot.
Apparently without the VERY_HIGH_SPEED settings, the rate somehow limited; but using these additional settings, 300kHz works fine for my purposes.

@mh- mh- closed this as completed Mar 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant