Can Linux Improve ADC Sampling Rate on Intel Galileo Gen 2?

  • Thread starter Thread starter cnh1995
  • Start date Start date
  • Tags Tags
    Adc Galileo
Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
7 replies · 4K views
Messages
3,489
Reaction score
1,173
I am working on a little project with intel galileo gen 2 which involves successive analog voltage readings of a sinusoidal waveform. I am using analogRead() function in Arduino IDE for that purpose. But the on-board ADC is extremely slow.The sampling rate I am getting is terribly small which is 500 samples per second. The clock frequency of the processor is 400MHz, so expected rate is around 1 million samples per second but I am getting nowhere near it. Is there any way to achieve that rate,like by changing the ADC's clock frequency? Arduino uno R3 shield is compatible with the board. Will that help?
 
Engineering news on Phys.org
cnh1995 said:
I am working on a little project with intel galileo gen 2 which involves successive analog voltage readings of a sinusoidal waveform. I am using analogRead() function in Arduino IDE for that purpose. But the on-board ADC is extremely slow.The sampling rate I am getting is terribly small which is 500 samples per second. The clock frequency of the processor is 400MHz, so expected rate is around 1 million samples per second but I am getting nowhere near it. Is there any way to achieve that rate,like by changing the ADC's clock frequency? Arduino uno R3 shield is compatible with the board. Will that help?

Is the on-board ADC high resolution? Is that why it is slow?

What resolution and sampling frequency do you want to have? As you say, there are probably shields that would have faster (lower resolution) ADCs on them...
 
  • Like
Likes   Reactions: cnh1995
berkeman said:
Is the on-board ADC high resolution? Is that why it is slow?

What resolution and sampling frequency do you want to have? As you say, there are probably shields that would have faster (lower resolution) ADCs on them...
Any resolution up to 16 bit is available.We can set it via analogReadResolution(x) command where x is the resolution in bits. I am using 10 bit resolution which is sufficient for me but the sampling rate should be much higher than 500 samples per second. The expected rate is around 1 million samples per second. Its a Texas Instruments ADC.
Should I try lower resolution for on-board ADC or go for any shield?
 
You're almost certainly limited by the software latency in the analogRead(x) command. Are there any low-level drivers you can access or any block read functions?

The analogReadResolution(x) function won't necessarily make it faster if it just truncates the output word of the ADC.
 
  • Like
Likes   Reactions: cnh1995
analogdesign said:
You're almost certainly limited by the software latency in the analogRead(x) command. Are there any low-level drivers you can access or any block read functions?

The analogReadResolution(x) function won't necessarily make it faster if it just truncates the output word of the ADC.
Then what is the standard procedure to use this ADC? I am not familiar with low level drivers or any block read functions. Where should I find them? Could you please elaborate?
 
The Gen 2 board seems to be using this device: http://www.ti.com/lit/ds/symlink/adc108s102.pdf
So the bare hardware is capable of 1 MSPS but it's also unlikely to be that fast without a SPI controller driver using DMA to buffer the data. A quick search has the max 'sketch' speed at about 500Hz which seems to be very slow due to the way they handle gpio access. The Linux speed will be faster using the spidev user driver but it seems even then the hardware and software is not optimized for wire speed SP transfers.

https://communities.intel.com/message/257595
 
  • Like
Likes   Reactions: cnh1995
nsaspook said:
The Gen 2 board seems to be using this device: http://www.ti.com/lit/ds/symlink/adc108s102.pdf
So the bare hardware is capable of 1 MSPS but it's also unlikely to be that fast without a SPI controller driver using DMA to buffer the data. A quick search has the max 'sketch' speed at about 500Hz which seems to be very slow due to the way they handle gpio access. The Linux speed will be faster using the spidev user driver but it seems even then the hardware and software is not optimized for wire speed SP transfers.

https://communities.intel.com/message/257595
How much faster will it be in Linux? I am using windows 8.1 now but I could run it on ubuntu.. Is there any shield which will be galileo compatible and get me higher sampling rate??
 
cnh1995 said:
How much faster will it be in Linux? I am using windows 8.1 now but I could run it on ubuntu.. Is there any shield which will be galileo compatible and get me higher sampling rate??

With Linux you should be able to have much faster speeds but using the device with the Arduino IDE might be faster if accessed in blocks.
https://communities.intel.com/message/231977
 
  • Like
Likes   Reactions: cnh1995