susane
Newbie level 6
Hello every one, i am an engineering student and i have been given a project, i want to communicate with ADS1292R with my Arduino UNO,
I have used the data sheet connections provided on page no 60.
i am using 4 wire SPI configuration, and for a good starting point, i just want to read a basic register with address 0x00, so i know that my communication is successful, but i am not able to do so,
Here is my code
If someone has experience with arduino and have done an SPI communication with this device, please help me
I have used the data sheet connections provided on page no 60.
i am using 4 wire SPI configuration, and for a good starting point, i just want to read a basic register with address 0x00, so i know that my communication is successful, but i am not able to do so,
Here is my code
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 RegData1 = 0;
int RegData2 = 0;
int RegData3 = 0;
int RegData4 = 0;
int RegData5 = 0;
int RegData6 = 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, LOW);
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);
RegData1 = SPI.transfer(0b00000000);// Dummy Data
delayMicroseconds(1);
RegData2 = SPI.transfer(0b00000000);// Dummy Data
delayMicroseconds(1);
RegData3 = SPI.transfer(0b00000000);// Dummy Data
delayMicroseconds(1);
RegData4 = SPI.transfer(0b00000000);// Dummy Data
delayMicroseconds(1);
RegData5 = SPI.transfer(0b00000000);// Dummy Data
delayMicroseconds(1);
RegData6 = SPI.transfer(0b00000000);// Dummy Data
delayMicroseconds(1);
digitalWrite(ADS1292_CS_PIN, HIGH);
Serial.print(RegData1,HEX);
Serial.print("\t");
Serial.print(RegData2,HEX);
Serial.print("\t");
Serial.print(RegData3,HEX);
Serial.print("\t");
Serial.print(RegData4,HEX);
Serial.print("\t");
Serial.print(RegData5,HEX);
Serial.print("\t");
Serial.print(RegData6,HEX);
Serial.print("\n");
}
If someone has experience with arduino and have done an SPI communication with this device, please help me