Go Down

Topic: Is it possible to get a 32 MHz sample rate with digital inputs? (Read 1 time) previous topic - next topic

PaulaS

Hi,
I was wondering if it is possible to sample a digital signal of 32 MHz with Arduino. The signal is the output of an ADC of 14 bits. This ADC comes wiht a bit for Data validation, which I think might be helpful for synchronization. I don't care about the model, I just need to know if it is possible to get this rate in any of them.

Thanks for your help.

rw950431

Given the typical ATMega328 based arduino runs a clock speed of 16Mhz I suspect the answer is no.

Budvar10

I have no complete knowledge about all Ardino boards but probably no one has 14bit ADC and 32MHz sampling. DUE and ZERO have 12bit ADC. You will need an extra chip for that (e.g. ADC from TI).
Arduino clone with ATmega1284P   http://forum.arduino.cc/index.php?topic=277260.0

jremington

I think you will need a micro with at least 320 MHz clock speed to sample at 32 MHz. The Raspberry Pi might be able to do that, if specially configured (linux is not a real time operating system).

PaulaS

I have no complete knowledge about all Ardino boards but probably no one has 14bit ADC and 32MHz sampling. DUE and ZERO have 12bit ADC. You will need an extra chip for that (e.g. ADC from TI).
Yes, the ADC is external. I've built a prototype with one from Maxim that meets this conditions and I would like to make a register of the digital output in my PC to analyze it.

 
I think you will need a micro with at least 320 MHz clock speed to sample at 32 MHz. The Raspberry Pi might be able to do that, if specially configured (linux is not a real time operating system).
I don't mind if it is real time or not, if I could save it somewhere (e.g. SD Card) and get it later it wouldn't be a problem. The problem is I'm not sure if an Arduino with a faster clock, like Due, would be able to keep a record of the data, especially since 84 MHz isn't a multiple of 32 MHz and the synchornization of both clocks could be a big issue. In any case, I'll look up the Raspberry Pi, thank you!

jremington

Quote
if I could save it somewhere (e.g. SD Card)
I believe the existing SD libraries are all single buffered. That means there is a big delay when a block is written out, so the capture size is limited by the amount of RAM memory.

Quote
I would like to make a register of the digital output in my PC to analyze it.
You can buy fast digital interfaces for your PC. Much, much easier than capturing with a uP.

pito

32MHz sample rate (14bit) to push into an SDcard is a fiction (aprox 60MB/sec).
Moreover, because of SDcard write latencies, you must buffer the data stream for the outages.
You may try with an FPGA and write to an SRAM/SDRAM wired to the FPGA.
Or an high end ARM with GBs of ram may help too..

PS: the max write speeds with arduino/due/teensy/stm32 is 1-4MB/sec, with 168MHz stm32F4xx and SDIO 6-8MB/sec to the SDCard, but still you have to cope with write latencies.

ard_newbie


A few thoughts about your Project.

You say you would need to sample 14 bits at the sampling rate of 32 MHz. The maximum speed you could obtain with the Arduino DUE is throughout a DMA transfer of 32_bit words.

Let's suppose that the target is to transfer 32_bit words at the pace of 32 MHz  =  128 M Bytes /s . But, some questions remain pending:

What would be the length of the recording ??
What do you try exactly to detect in the incoming signal ??
More details on your project could eventually lead to a better understanding, and an Arduino solution. As we know only a very limited part of your overall project, it is extremely difficult to imagine the best trade off with an Arduino board!!.

The DUE has 96 KB contiguous SRAM plus 4 KB SRAM not contiguous, so let's imagine that 10 K 32_bit words would be enough.

If you choose 14 pins of PIOB, and consider transferring the content of PIOB->PIO_PDSR to a buffer, you can achieve this within a memory2memory AHB DMA, although for some reasons, reading the memory PIO->PIO_PDSR is not exactly like reading an SRAM buffer.

Some time ago I did a few tests and achieved a 86 M Bytes /s transfer from PIOB->PIO_PDSR to a 2048  32_bit words buffer. I suspect that this is due to a bus contention somewhere because an SRAM to SRAM memory2memory AHB DMA can be done at the pace of 130 M Bytes /s. I tried to modify the bus Matrix arbitration without much success to overcome this limitation.

Second option : Arduino DUE has an High Speed Multimedia Card Interface (HSMCI) which has its own  dedicated DMA programmable through the HSMCI_DMA register. The HSMCI operates at a rate of up to Master Clock divided by 2 (i.e. 84 MHz/2 = 42 MHz) and supports the interfacing of 2 slot(s). Each slot may be used to interface with a High Speed MultiMediaCard bus (up to 30 Cards) or with an SD Memory Card.

I didn't try this feature but it would be the best answer to transfer a very large record, although as already stated in this thread, an SD card introduces some latencies.

Third option : Arduino DUE is 3.3v compliant and you can hook your analog device directly to one of the twelve available analog pins (A0,1,2,3,4,5,6,7,10,11,12,13) of the 12-bit Analog-to-Digital Converter (ADC). In this case, the best you can expect is a pace of MCK / 2/21 = 2 M samples/s within a peripheral to memory PDC DMA.


MarkT

Hi,
I was wondering if it is possible to sample a digital signal of 32 MHz with Arduino. The signal is the output of an ADC of 14 bits. This ADC comes wiht a bit for Data validation, which I think might be helpful for synchronization. I don't care about the model, I just need to know if it is possible to get this rate in any of them.

Thanks for your help.
What ADC?  Is this serial or parallel?  Either way is way higher than Arduinos are designed for.
What is the sample rate of the ADC?  Is this something like software-defined radio or something?
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

dlloyd

OK, after reading your original post, I think the word "sample" should be replaced with "read" ...

Quote
I was wondering if it is possible to read a digital signal of 32 MHz with Arduino. The signal is the output of an ADC of 14 bits. This ADC comes with a bit for Data validation, which I think might be helpful for synchronization. I don't care about the model, I just need to know if it is possible to get this rate in any of them.
I think its possible, but a link to your ADC is needed.

The Arduino Due's SPI can transfer data at 42MHz when DMA is used.

With the SPI in slave mode, set to 15 bits per transfer and using DMA, this seems to be well within the capability of the Due. Note that in this case, the SPI clock is set by the peripheral (your ADC chip) and the sampled data would be serially transferred to the Due at 32MHz clock rate.

MarkT

Just one important detail - ADC chips are SPI slaves, not masters, they don't self clock.
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

dlloyd

Ah, then using SPI master with Due's default 84MHz master clock, could use 28MHz SPI clockrate which is 87.5% of the desired speed.

If Due's master clock is set to 64MHz, then 32MHz SPI clockrate is possible.

Go Up