Need help getting ADS1298 to work with teensy 3 SPI

Status
Not open for further replies.

linuxgeek

Well-known member
I've been trying to get a TI ADS1298 chip to work with the teensy 3.x. It's an extraordinary EEG/EMG/ECG chip, or it can be just a high-quality instrumentation amplifier.
This is my first time using SPI, except for the sdcard.

tingo has written a library for it, and I'm trying to get that to work.

I've put the chip onto a prototyping board, and have it plugged in to a breadboard along with a teensy 3.0.
I've got a very basic sketch to see if I can communicate with the board. Basically just trying to get the chip to output an id of the chip.

Here are my connections between the ads1298 and the t3. To make it easier to read, the green colored pins is what I think are the essential ones to communicate with the chip, but I have them all connected.
ads1298_t3_pins.png

The datasheet to the ads1298:
http://www.ti.com/lit/ds/symlink/ads1296.pdf

The pinout diagram from the datasheet:
ads1298pinout.png

Here's the sketch
Code:
#include <ADS129xADC.h>
#include <ADS129xInfo.h>
#include <SPI.h>

ADS129xADC ads129x = ADS129xADC();
int ledPin = 13;

void setup() 
{
/* this can be ignored, just a countdown to see the if the t3 is working
  pinMode(ledPin, OUTPUT);
  
  for (int i=0;i<5;i++) {
    Serial.print(".");
    digitalWrite(ledPin, HIGH);
    delay(500);
    digitalWrite(ledPin, LOW);
    delay(500);
  }
  Serial.print("waiting another 5 sec");
  for (int i=0;i<5;i++) {
    Serial.print(".");
    digitalWrite(ledPin, HIGH);
    delay(500);
    digitalWrite(ledPin, LOW);
    delay(500);
  }
*/
  ads129xSetup();
}

void ads129xSetup()
{
 ads129x.initInt(10);
 ads129x.pwrUp();
// uint8_t id = adc129x.getID();
int id = ads129x.getID();
 Serial.print("adc129xID: ");
 Serial.print(id);
}

void loop() {
  // put your main code here, to run repeatedly:

}

The sketch runs, but getID() just returns a zero, which is the default if nothing is detected.

Here is the segment of the library code that is related to the pins:
Code:
#define USE_SOFT_SPI 0

#include "Arduino.h"

#if USE_SOFT_SPI
    #include "SoftSPI.h"
    uint8_t const ADS_SOFT_SPI_MISO_PIN = 16;
    uint8_t const ADS_SOFT_SPI_MOSI_PIN = 15;
    uint8_t const ADS_SOFT_SPI_SCK_PIN  = 14;
    uint8_t const SPI_MODE = 1;
    extern SoftSPI<ADS_SOFT_SPI_MISO_PIN, ADS_SOFT_SPI_MOSI_PIN, ADS_SOFT_SPI_SCK_PIN, SPI_MODE> SPI;
#else
    #include "SPI.h"
#endif

/** Define ADC control pins */
uint8_t const ADS_PWDN_PIN     = 2;
uint8_t const ADS_RESET_PIN    = 3;
uint8_t const ADS_START_PIN    = 4;
uint8_t const ADS_CLKSEL_PIN   = 6;
uint8_t const ADS_DRDY_PIN     = 7;
uint8_t const ADS_CS_PIN       = 10;

Here is the library, and I put it in <arduino>/hardware/teensy/avr/libraries/ADS129xADC. I did minor edits for spelling correction and "USE_SOFT_SPI 0"
View attachment ADS129xADC.zip

related forum links here:
https://forum.pjrc.com/threads/24816-Faster-digital-I-O-for-soft-SPI
https://forum.pjrc.com/threads/26207-Teensy-ADS129x-ADC-SD-card

I also tried pin 13 & 14 for CLK, but same problem.

Thanks in advance for any help or guidance.
 
ADS pin 40 is the SPI clock input. Pin 37 (CLK) is the input pin for the master clock but the library uses the internal oscillator.
Connect pin 40 to Teensy pin 13 . Leave pin 37 floating. Don't use pin 13 as led pin.

It's probably better to connect all supply/ground pins. And pin 31, 41 to DGND.
 
Last edited:
Thank you for the help! Unfortunately moving T3 pin 13 to ADS pin 40 didn't seem to do anything.

I double-checked the connections, but I'm going to test them all and make sure they are all connected. And I'll wire up all the ones you suggested.
 
Status
Not open for further replies.
Back
Top