Go Down

Topic: Sampling rate verification (Read 1 time) previous topic - next topic

dc42

You code uses the conversion complete interrupt to trigger a new conversion. By then you've probably missed the boat and need to wait an extra ADC clock cycle or two to start the new conversion. I think you need to put the ADC in continuous conversion mode to achieve the quoted maximum conversion rate.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

dhenry

I got 31128hz.

You can do the math but you will find that it takes 250 ticks to finish adc and to flip the pin. So the pin flip has a period of 500 ticks -> 32Khz.

dhenry

The highest I can get is 38647hz (latency is not an issue here).

That confirms the 77k sample rate in the datasheet.


chung


You code uses the conversion complete interrupt to trigger a new conversion. By then you've probably missed the boat and need to wait an extra ADC clock cycle or two to start the new conversion. I think you need to put the ADC in continuous conversion mode to achieve the quoted maximum conversion rate.

Bingo! I switched to free-running mode and the frequency rose up to 38.46kHz!
An Arduino development board costs €20~60. A pack of 20 Zener diodes to protect your board from almost certain damage costs less than €1...

chung

#19
Nov 11, 2012, 04:10 pm Last Edit: Nov 11, 2012, 04:37 pm by chung Reason: 1

I got 31128hz.

Why do I get 29.4kHz on single conversion mode?  :~ :0

Update...

OK, I figured out why I get a lower frequency... The signal I measure with my oscilloscope is noisy. Maybe, some capacity creates what is shown on the attached image.



After processing the data with Matlab, I also get 31kHz for the single conversion mode and 40.7kHz for the free running mode.

An Arduino development board costs €20~60. A pack of 20 Zener diodes to protect your board from almost certain damage costs less than €1...

dhenry

Hopefully by now you have figured out why the falling edge isn't so sharp.

chung

#21
Nov 11, 2012, 05:38 pm Last Edit: Nov 11, 2012, 05:53 pm by chung Reason: 1

Hopefully by now you have figured out why the falling edge isn't so sharp.


Yes, I just figured it out. I had connected a LED (and a resistor) between the output of the pin and the GND  smiley-lol. I removed the LED and now I get a nice square wave @38.17kHz.

Update: FIY: The highest achievable rate (wrt the generated pulse) in free-running mode was 121.4kHz.
An Arduino development board costs €20~60. A pack of 20 Zener diodes to protect your board from almost certain damage costs less than €1...

Go Up