I'm just curious if anyone has used this AD7124 24-bit ADC at higher data rates, for example 1 kHz or above. The Analog Devices AD7124 datasheet claims it is capable of sampling rates up to 19200 sps.
Using the "continuous conversion" mode and whether or not I wait for a sample to complete, I get at most 320 samples per second, no matter what sampling rate I select, down to "1" which is maximum speed. I also tried only printing out only every 100th result, or printing nothing at all, in case there was a problem with USB overhead. I'm using a Teensy 4.0.
Looking at the /CS and Clock lines with a scope, I see the chip is selected for 41 usec every 1.033 msec. Some reads are 3 bytes, some 5 bytes, some two sets of 5 bytes. Apparently, only every third or fourth transaction ends up reading out a value.
My testing code is below.
Using the "continuous conversion" mode and whether or not I wait for a sample to complete, I get at most 320 samples per second, no matter what sampling rate I select, down to "1" which is maximum speed. I also tried only printing out only every 100th result, or printing nothing at all, in case there was a problem with USB overhead. I'm using a Teensy 4.0.
Looking at the /CS and Clock lines with a scope, I see the chip is selected for 41 usec every 1.033 msec. Some reads are 3 bytes, some 5 bytes, some two sets of 5 bytes. Apparently, only every third or fourth transaction ends up reading out a value.
My testing code is below.
Code:
// use epsilonRT library for AD7124
// https://github.com/epsilonrt/ad7124
#include <ad7124.h>
Ad7124Chip adc;
// Physical Pins
const int ssPin = 10;
const int outFlag = 9;
long dataWord;
byte ch;
// Sample Speed Setting (Full Power Sinc3 Filter Mode)
// FW | SPS | SPS/Ch
// 600 | 6 | 1
// 100 | 60 | 10
// 40 | 156 | 26
// 20 | 300 | 50
int filterWord = 5;
void setup() {
pinMode(outFlag, OUTPUT);
digitalWrite(outFlag, 0);
Serial.begin (115200);
int state = adc.begin(ssPin);
while (state < 0) {
delay(100);
state = adc.begin(ssPin);
}
// Configuring ADC in Full Power Mode & Continuous Mode (Prevents sleep mode)
adc.setAdcControl(Ad7124::ContinuousMode, Ad7124::FullPower, true);
adc.setMode(Ad7124::ContinuousMode);
// Configure Channel 0
adc.setConfig(0, Ad7124::RefInternal, Ad7124::Pga1, true);
adc.setConfigFilter(0, Ad7124::Sinc3Filter, filterWord);
adc.setChannel(0, 0, Ad7124::AIN3Input, Ad7124::AIN2Input, true);
adc.enableChannel(0,true);
delay(100);
}
void loop() {
const int setSize = 100;
for (int i=0;i<setSize; i++) {
adc.waitEndOfConversion(500);
dataWord = adc.getData();
}
Serial.println(dataWord);
}