Hello all,
I have been testing the ADS1298 which is attached to a proto board with pins going into breadboards. Everything seems to be attached properly according to the datasheet. I am setting the pins RESET, PWDN, START, and CLKSEL high. Originally, I began to see 4ms pulses at the DRDY pin measured on an oscilloscope so I moved onto testing SPI commands. First I ran code to try and change the frequency of pulses at DRDY to be every 2 ms. When I ran the code, the Arduino began to disconnect or stop being recognized by my laptop. So I went back and used the code that set the high pins and what happened was it started to give me the 4 ms pulses again but after a few seconds changed to 2ms.
I switched between the two sets of code and the same thing kept happening. Also, this could be because the setup uses many wires and is quite noisy, but I get a few stray square pulses at the DRDY pin that look like this:
This was taken after the DRDY switched from 4ms to 2ms impulses. This square pulses are spread across the output. So I guess I am wondering if someone knows what this means or if there is a way to correct it. Code is attached below if you would like to take a look. The first is the code to set pins high and second is the SPI communication which is the one that causes the Arduino to fail.
Any help is much appreciated! Thank you
Derek
Setting pins high:
void setup() { pinMode(13, OUTPUT); pinMode(12, OUTPUT); pinMode(11, OUTPUT); pinMode(10, OUTPUT); } void loop() { digitalWrite(13, HIGH); digitalWrite(12, HIGH); digitalWrite(11, HIGH); digitalWrite(10, HIGH); delay(1000); delay(1000); }
SPI Communication:
//Includes Arduino SPI library // #include <SPI.h> // ADS1298 memory register addresses: const int CONFIG1 = 0x01; //Configures data rate const int CONFIG2 = 0x02; //Configures test signal generation const int CONFIG3 = 0x03; //Configures multi-reference and RLD operation // ADS1298 commands const byte RDATAC = 0b00010000; //Read data continuous mode commmand const byte RDATA = 0b00010010; //Read data by commmand const byte SDATAC = 0b00010001; //Stop reading data continuously // Pin definition //According to SPI Arduino Library: //MOSI: Pin 11 //MISO: Pin 12 //SCK: Pin 13 //SS: Pin 10 // const int dataReadyPin = 6; const int chipSelectPin = 7; void setup() { Serial.begin(115200); // Start SPI library SPI.begin(); // Initialize Pins pinMode(dataReadyPin, INPUT); pinMode(chipSelectPin, OUTPUT); pinMode(2, OUTPUT); pinMode(3, OUTPUT); pinMode(4, OUTPUT); pinMode(5, OUTPUT); writeRegister(CONFIG1, 0b10000110); } void loop(){ //COnfiguring ADS1298: //writeRegister(CONFIG1, 0b10000110); //give the ADS time digitalWrite(2, HIGH); digitalWrite(3, HIGH); digitalWrite(4, HIGH); digitalWrite(5, HIGH); } void writeRegister(byte thisRegister, byte thisValue) { // SCP1000 expects the register address in the upper 6 bits // of the byte. So shift the bits left by two bits: //thisRegister = thisRegister >> 2; // now combine the register address and the command into one byte: byte dataToSend = 010 | thisRegister | 00000001 ; // take the chip select low to select the device: digitalWrite(chipSelectPin, LOW); SPI.transfer(dataToSend); //Send register location SPI.transfer(thisValue); //Send value to record into register // take the chip select high to de-select: digitalWrite(chipSelectPin, HIGH); }