Problem with ADS1256 board

Hi!

Using an ADS1255 (basically the same IC as ADS1256) and dariosalvi code got my ADS1255 working (btw the sample code was missing "SPI.endTransaction();" at the end of the setup).

I've adapted the code a bit to match my setup and configured one more register (DRATE) in order to make sure the ADC is working at it's full 30kSPS potential and the results I'm getting are quite chaotic, making no sense at all:

72655
2966232813
3436158698
255799543
3473817828
534761477
3506425644
1627348985
4257216639
28320544
548220649
3772690109
3792572396
282054638
1610440670
268468467
64021071
1374023375
3174706
4043223809
95399897
871358517
1325613092
1325416659
4267691519

Does anyone know what's the problem?

Here is my code

#include <SPI.h>
#define SPISPEED 1250000

#define SCK   14
#define MOSI  12
#define MISO  27
#define DRDY  26
#define CS 5

#define WREG  0x50
#define RDATA 0x01


void setup()
{
  Serial.begin(2000000);

  pinMode(MISO, INPUT);
  pinMode(MOSI, OUTPUT);
  pinMode(SCK, OUTPUT);
  pinMode(CS, OUTPUT);
  SPI.begin(SCK, MISO, MOSI, CS); //start the spi-bus
  delay(1); // LOW at least 4 clock cycles of onboard clock. 100 microsecons is enough

  pinMode(DRDY, INPUT);

  while (digitalRead(DRDY)) {}  // wait for ready_line to go low

  SPI.beginTransaction(SPISettings(SPISPEED, MSBFIRST, SPI_MODE1)); // start SPI
  //  Reset to Power-Up Values (FEh)
  SPI.transfer(0xFE);
  delayMicroseconds(100);

  //PGA SETTING
  //1 ±5V
  //2 ±2.5V
  //4 ±1.25V
  //8 ±0.625V
  //16 ±312.5mV
  //32 ±156.25mV
  //64 ±78.125mV

  byte status_reg = 0x00;  // address (datasheet p. 30)
  byte status_data = 0B0000001;
  //000 0 0 0 1
  //000 - Factory programmed Identification Bits
  //0 - set MSB transfer
  //0 - Auto-Calibration Disabled
  //0 - Buffer Disabled
  //1 - duplicates state of DRDY pin
  SPI.transfer(WREG | status_reg);
  SPI.transfer(0x00);   // 2nd command byte, write one register only
  SPI.transfer(status_data);   // write the databyte to the register
  delayMicroseconds(10);


  byte adcon_reg = 0x02; //A/D Control Register (Address 02h)
  byte adcon_data = 0B00000000;
  // 0 00 00 000
  // 0 reserved always 0
  // 00 - Clock Out off
  // 00 - Sensor Detec off
  // 000 - PGA gain = 1
  SPI.transfer(WREG | adcon_reg);
  SPI.transfer(0x00);   // 2nd command byte, write one register only
  SPI.transfer(adcon_data);   // write the databyte to the register
  delayMicroseconds(10);



  byte drate_reg = 3; //data rate register address: 0x3h
  byte drate_data = 0B00000011;
  // 11110000
  //set data rate to max. (30000 SPS)
  SPI.transfer(WREG | drate_reg);
  SPI.transfer(0x00);   // 2nd command byte, write one register only
  SPI.transfer(drate_data);   // write the databyte to the register
  delayMicroseconds(10);



  byte mux_reg = 0x01; //Mux Register (Address 01h)
  byte mux_data = 0B00001111;
  // 0000 1111
  // 0000 - AIN0 (default)
  // 1111 - AINCOM
  SPI.transfer(WREG | mux_reg); // MUX register
  SPI.transfer(0x00);   // 2nd command byte, write one register only
  SPI.transfer(mux_data);   // write the databyte to the register
  delayMicroseconds(10);

  //SYNC command 1111 1100
  SPI.transfer(0xFC);
  delayMicroseconds(10);

  //WAKEUP 0000 0000
  SPI.transfer(0x00);
  delayMicroseconds(10);


  SPI.endTransaction();

  Serial.println("configured, starting");
}


void loop()
{
  unsigned long adc_val = 0; // store reading

  while (digitalRead(DRDY)) {} ;

  SPI.beginTransaction(SPISettings(SPISPEED, MSBFIRST, SPI_MODE1)); // start SPI
  SPI.transfer(RDATA); // Read Data 0000  0001 (01h)
  // delayMicroseconds(10);

  adc_val = SPI.transfer(0xff);  //0xff is a dummy
  adc_val |= (uint32_t)SPI.transfer(0xff) << 8;
  adc_val |= (uint32_t)SPI.transfer(0xff) << 16;
  adc_val |= (uint32_t)SPI.transfer(0xff) << 24;
  SPI.endTransaction();

  //The ADS1255/6 output 24 bits of data in Binary Two's
  //Complement format. The LSB has a weight of
  //2VREF/(PGA(223 − 1)). A positive full-scale input produces
  //an output code of 7FFFFFh and the negative full-scale
  //input produces an output code of 800000h.
  if (adc_val > 0x7fffff) { //if MSB == 1
    adc_val = (16777215ul - adc_val) + 1; //do 2's complement
  }
  Serial.println(adc_val);
}

And the schematic that I use for ADS1255
ADS1255-schematic