ultra fast analogRead and nanoseconds()

hello, I am working on an aplication that requires an analogix aceleromter to be attached in a moving part. I have already discart i2c and spi systems because I need speed and an accurate timi g.

Analogread(PinNumber) takes like 120us un an aeduino based on 328p atmel i also need to correlate a very precise time base to associate the analogread with a position of my system of a known speed.

I have checked to modify timer0 and other thinls like accesing direct to the ports.

can i access to any register that stores clock cycles? do it exist? what is the faster counter existing in the atmega? is there any way to speed up the analogread up keeping at least the 10bit and accuracy? any option to use like a function like nanoseconds()????? if i buy an arduino due with 84mhz of clock. will i be able to get better performance in make a spreedsheet like analogread vs nanoseconds()?????? any link with deep info about fast counting????? regards,

i also need to correlate a very precise time base The CPU clocks on Arduinos are not accurate.

is there any way to speed up the analogread up keeping at least the 10bit and accuracy? No.

any option to use like a function like nanoseconds()? No.

You seem to be looking for the kind of specialised hardware using in scientific high speed data acquisition. That costs. The closest you are likely to get in this sort of forum is a budget digital storage scope, but they usually are limited to 8 bit flash ADCs rather than 12 bit or better.

Flash ADCs above 8 bit get expensive, and the datapath needed to support them is also expensive.

What sort of sample rate are you wanting? High accuracy at high speed is tricky stuff due to stray reactances. Even a tiny amout of low-pass roll off (well below the knee frequency) is more than one part in 2^12. And then there's phase-distortion to consider... Its gets hairy.

You can find very fast external ADCs with SPI interface at Digikey.

Surely that's fast, not 'very fast'. 100MSPS+ flash converters are available, way beyond SPI's ability.

@conander:

If 1 million samples/second is sufficiently fast for your project, you could consider using an Arduino DUE and code a PDC DMA and maybe an AHB DMA memory to memory is even faster.

An example of this : http://forum.arduino.cc/index.php?topic=137635.0 from #8

You are going to need specialized hardware - there are two problems even at 10 million samples/second - not only do you have a problem getting that sample (and a front end that provides a distortion free waveform), but what are you going to do with 10 million samples in a second - even at 8 bits, that is 10megabytes of data/second and that is not going to fit in any existing uno hardware. Look at a digital storage scope for an example of what you want to do - they have fast converters and fairly deep RAM to store the samples in, but that is specialized hardware.