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.

ADS1299: Can't read registers through SPI communication

Part Number: ADS1299

Hi,

I have ADS1299 EEG-FE evaluation board through which I am trying to read its register values by using SPI communication through Arduino Due Microcontroller. I have used the following code in which at first, I have sent a RESET command and then I have sent Register Read command for CONFIG1 register. According to its datasheet, I should get a value 96h. But I am getting random values at each iteration of the loop. I want to know the sequence of steps needed to read register values and subsequently to read data values from channels.

The code is as follows:

#include<SPI.h>

byte Value = 0xA9; // The variable to store the value of incoming byte. Setting a predefined value so that if there is no data transferred, it shows a predefined value on oscilloscope.

void setup() {
// put your setup code here, to run once:
pinMode(10, OUTPUT); // Chip Select
pinMode(8, OUTPUT); // Output on Oscilloscope

SPI.begin();
SPI.beginTransaction(SPISettings(1500000, MSBFIRST, SPI_MODE1)); // 1.5 MHz
digitalWrite(10, LOW); // Chip Select LOW
}

void loop() {
// put your main code here, to run repeatedly:
digitalWrite(8, LOW); // Begin oscilloscope by 0
delay(100);
SPI.transfer(0x06); // RESET Command issued
delayMicroseconds(20); // Delay of more than 18 clock cycles
SPI.transfer(0x11); // Stop Data command
delayMicroseconds(20);
SPI.transfer(0x21); // Send Read register command with address of register
delayMicroseconds(3);
SPI.transfer(0x00); // Read only one register
delayMicroseconds(3);
Value = SPI.transfer(0x00); // Read the value
delayMicroseconds(3);
for (int i=0; i<8; i++)
{
digitalWrite(8, bitRead(Value,7-i)); // Display the value on oscilloscope
delay(100);
}
digitalWrite(8, LOW);
delay(1000);

}

Thanks,

  • Hello Mohit,

    Thanks for your post and welcome to the forums!

    Try following section "10.1.2 Setting the Device for Basic Data Capture" of the ADS1299 datasheet. This should get a device ready for basic functions, let me know if you have more questions!