This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

ADS127L01EVM: and Arduino SPI Interfacing

Part Number: ADS127L01EVM
Other Parts Discussed in Thread: ADS127L01

Hi there,

I have been struggling to acquire reasonable readings from the ADS127L01EVM using an external microcontroller. The board itself is operating excellently (and we are very happy with the performance characteristics) as we were able to test it with the TI Delta-Sigma ADC EvaluaTIon Software. 

Now, we are trying to use an Arduino to communicate with the device via SPI and read a voltage. 

Our hardware setup is as follows (Pin X refers to Arduino connections): 

  • CS is tied low by installing a jumper on J6[1].
  • START pin, which is tied to DVDD, is tied to Pin 8 (set to OUTPUT) via TP21 (JP11 is uninstalled). 
  • JP5 is installed to power down Y1 and JP6[3] is tied to Pin 5 (set to OUTPUT). Pin 5 is configured on the Arduino to supply an 8MHz clock signal to the EVM board as per Section 5.6 in the datasheet.
  • External 5V supply is connected to JP3[2] (supplied from the Arduino 5V pin).
  • The external supply ground is shared with the EVM ground using one of the GND test points.
  • On S3, HR=1, FORMAT = 0, OSR[1:0] = 00, FSMODE = 0, FILTER[0:1] = 01 as per Table 2 in the datasheet. 
  • The SPI port is connected to the corresponding SPI pins on the Arduino (MISO, MOSI, SCLK). 
  • The DRDY pin is connected to Pin 4 (set to INPUT).

When this setup is completed and the Arduino connected to power, the ADS127L01EVM lights up (so it seems things are connected properly). 

The difficulty comes when I upload my program to read conversion results. I connected a 3.3V DC voltage to the terminal block and I get this output: 

What's good is that it looks like I'm clocking out data from the device, but what's bad is it's nonsense. The periodicity of the "spikes" looks like the problem could originate from the void loop() function in the Arduino program, but I'm unsure. I am returning unformatted data (not converting to voltage, hence the y-axis scale). 

Here is my Arduino sketch: 

#include <SPI.h>
#include <avr/io.h>
#include <util/delay.h>

//define constants
const int DRDY_pin = 4;
const int START_pin = 8;
const byte readCommand = 0b00010010; //RDATA command from Table 19. Command Definitions
const byte blank = 0b00000000; 
SPISettings settingsA(16000000, MSBFIRST, SPI_MODE1); //1.6MHz SCLK, CPOL = 0, CPHA = 1)

void setup() {

pinMode(3, OUTPUT); // Output pin for OCR2B timer
pinMode(5, OUTPUT); // Output pin for OCR0B timer
// Set up the 8 MHz output
TCCR0A = bit(COM0A1) | bit(COM0B1) | bit(WGM01) | bit(WGM00);
TCCR0B = bit(WGM02) | bit(CS00);
OCR0A = 1;
OCR0B = 0;

//Setup SPI device
Serial.begin(115200);
pinMode (DRDY_pin, INPUT);
pinMode (START_pin, OUTPUT);
//Synchronization Timing (SPI Interface) as per Figure 85.
digitalWrite(DRDY_pin, LOW);
digitalWrite(START_pin, HIGH);
digitalWrite(START_pin, LOW); //in SPI interface mode, DRDY goes high as START is taken low (it's an active-low pin)
delayMicroseconds(4); //t_w(STL)
SPI.begin();

}

void loop() {

digitalWrite(START_pin, HIGH); //After START is returned high, DRDY stays high while the digital filter completes reset and settles
if(digitalRead(DRDY_pin) == LOW){ //After valid data are ready for retrieval, check for DRDY goes low
Serial.println(readADC(readCommand), 10); //Send readADC command, output with 10 significant figures.
//delayMicroseconds(10);
}

}

float readADC(byte primaryConfig){

noInterrupts(); //disable interrupts
SPI.beginTransaction(settingsA); // set settingsA
delayMicroseconds(5);
SPI.transfer(primaryConfig); // send read byte command
byte firstByte = SPI.transfer(0x00); // read the first byte
byte secondByte = SPI.transfer(0x00); // read the second byte
byte thirdByte = SPI.transfer(0x00); // read the third byte 
interrupts(); //enable interrupts 
int firstSixteenBits = (firstByte << 8) | secondByte;
int lastTwentyFourBits = (firstSixteenBits << 8) | thirdByte;
float valueDEC = (float(lastTwentyFourBits) * 5.00000) / 16777216.0000000; // convert into voltage using a reference of 5.0000V
float valueNOFORMAT = float(lastTwentyFourBits);
//return valueDEC;
return valueNOFORMAT; 
SPI.endTransaction();
//delayMicroseconds(3);

}

This is the oscilloscope trace of the DIN/MOSI (1) and SCLK (2) lines. As can be seen, the RDATA command is sent, followed by 3 empty byte commands when the Arduino reads the DOUT line (not shown in the oscilloscope trace).

I have a few questions about all of this is: 

  1. What is the correspondence between Figure 1. SPI Interface Timing, Figure 85. Synchronization Timing (SPI Interface), and Figure 91. SPI Keep-Out Time (tKO)? Are they to be interpreted simultaneously? Where does the DIN command come into play in Figure 91? To me, Figure 91 implies that you don't need to send any read commands at all since all you have to continually check the DRDY line.
  2. Does the START pin have to be raised high after each conversion? 
  3. If I wanted to continuously sample an input voltage, do I just issue one start command and then follow Figure 91? Currently, I'm sending the start command at each loop iteration. 

We will eventually use a Raspberry Pi for the end use of the ADC because we will need to use it at 512ksps (and the Arduino serial write speed limits us). Our first priority is just understanding the mechanics of how to communicate properly with the device and get the results we expect.

Your assistance is much appreciated.

Rohan Nuttall

Vancouver, Canada

  • Hello Rohan,

    Thank you for your questions and interest in the ADS127L01!

    Before we get too far, I would like to confirm a few details regarding your setup:

    1. If you wish to control the START pin with your Arduino, you'll need to make a jumper wire from the low side of R67 (connected to the START pin), not from the DVDD test point (TP21). This resistor pulls the START pin high to DVDD to leave the ADS127L01 converting continuously.
    2. If JP11 is uninstalled, then there is nothing connected to the digital supply for the ADS127L01. Do you have an external supply shorted to JP11[2]? In fact, since you tied TP21 to your Arduino, you are effectively toggling the digital supply each time you try to pull START high or low. I believe this is likely the main issue.
    3. Did you mean FILTER[1:0] = 01 (Wideband 2 filter) or FILTER[1:0] = 10 (Low-latency filter). I'm assuming you're using the Wideband 2 filter since you mentioned running the ADC at 512kSPS.
    4. JP1 should be installed and the remaining jumpers should be in their default position.

    The analog supply (AVDD) is connected to 3V. Therefore, you should not be applying a 3.3-V DC input to J8. 3.3V is right at the Absolute Maximum Ratings to avoid device damage, but this is beyond the Recommended Operating Conditions. Also, the reference voltage (VREF) for the ADS127L01 is 2.5V on the EVM, so the ADC cannot convert a differential input greater than that anyways.

    To your other questions:

    1. Yes, all of the timing specifications should be followed. Figure 1 is where you'll find the majority of the timing specifications needed for general communication. If you need to pulse the START pin at any point (i.e. upon start-up, or to resynchronize multiple ADCs, etc.), Figure 85 illustrates how long you should expect to wait until you see valid data. You can only control the pulse width and the time between START and CLK rising edges. Finally, Figure 91 illustrates how close to the /DRDY falling edge you are allow to send SCLKs. Theoretically, this applies when you are sending commands on DIN as well as to when you are reading data on DOUT, but primarily is applies to the latter.
    2. No, START can be left high throughout your data acquisition. In fact, is not recommended to toggle START high/low between conversions. Doing so would reset the digital filter and create a significant latency each time you wish to read data. For the Wideband filters, the digital filter requires 84 conversions before the output data is fully-settled.
    3. If the START pin is already high, you do not need to send the START command. The START command is only needed when the user ties the START pin low with a resistor. In that case, the MCU can control the conversions via SPI.

    Let me know if you are still have difficulty and we'll go from there.

    Best Regards,