Hello Everyone
i have bought ADS1292R, i made the connection on a veroboard using the connection diagram in the datasheet.
I have connected the SPI wires with arduino uno.
I dont want to read any ECG data for start, i just want to read a basic register so i am sure that the SPI communication is fine.
I made a code to read the register 0x00, but i am only getting 0 on the serial monitor.
Can anyone tell me what i am doing wrong?? are there any settings that i need to do before reading the register?
i did sent the wakeup command in the beggining.
here is my code
#include <SPI.h>
int ADS1292_DRDY_PIN = 6; /// Not used for now
int ADS1292_CS_PIN = 10; ////// Working
int ADS1292_START_PIN = 5; /// Working
int ADS1292_PWDN_PIN = 4;////// Working
int ADS1292_CLK_SEL = 3; /// Working
int dat2 = 0;
int dat1= 0;
int RegData = 0;
void setup() {
pinMode(ADS1292_DRDY_PIN, INPUT); //6
pinMode(ADS1292_CS_PIN, OUTPUT); //10
pinMode(ADS1292_START_PIN, OUTPUT); //5
pinMode(ADS1292_PWDN_PIN, OUTPUT); //4
pinMode(ADS1292_CLK_SEL, OUTPUT); //3
//////////// Power up sequence////////////
delay(10);
digitalWrite(ADS1292_PWDN_PIN, HIGH);
delay(9000);
digitalWrite(ADS1292_PWDN_PIN, LOW);
delay(100);
digitalWrite(ADS1292_PWDN_PIN, HIGH);
delay(1000);
////////////////////////////////////////////
///// Set CLKSEL to 1////////////
digitalWrite(ADS1292_CLK_SEL, LOW);
delay(100);
digitalWrite(ADS1292_CLK_SEL, HIGH);
delay(10);
//////////////////////////////////////////
/////// Setting start pin to LOW////////
digitalWrite(ADS1292_START_PIN, HIGH);
delay(100);
SPI.begin();
SPI.beginTransaction(SPISettings(1000000,MSBFIRST,SPI_MODE1));
delay(1000); // Wait for SPI to begin
Serial.begin(9600);
}
void loop() {
// Sending the first command to ADS for SDAC so registers can be written
digitalWrite(ADS1292_CS_PIN, LOW);
delayMicroseconds(5);
SPI.transfer(0b00000010); //// SPI Command for Wakeup
delayMicroseconds(5);
SPI.transfer(0b00010001); //// SPI Command to STOP read data continous mode
delayMicroseconds(5);
SPI.transfer(0b00100000); // Read register command
delayMicroseconds(5);
SPI.transfer(0b00000000); // Number of Registers to read
delayMicroseconds(5);
RegData = SPI.transfer(0b00000000);// Dummy Data
delayMicroseconds(1);
digitalWrite(ADS1292_CS_PIN, HIGH);
Serial.print(RegData,HEX);
Serial.print("\n");
}