Reading and Writing to LTC6803-3 Through SPI using Arduino UNO

Hey guys.

I've been struggling with this issue for the past few days and am hoping to find some help here.

I'm currently trying to set up a battery monitor project which uses an Arduino UNO board to read and write data from many different ADCs on the board.

The chip which I'm finding increasingly frustrating to communicate with is the LTC6803-3, whose datasheet is found here: http://cds.linear.com/docs/en/datasheet/680313fa.pdf.

Below is the code I've already tried:

#include <SPI.h>

byte WRCFG = 0x01;
byte RDCFG = 0x02;
byte RDCV = 0x04;
byte STCVAD = 0x10;
byte WPEC = 0xC7;
byte RVPEC = 0xDC;
byte RCPEC = 0xCE;

const int CS0 = 4;
const int CS1 = 5;
const int CS2 = 6;
const int DECODER_EN = 7;
const int SCKPIN = 13;

byte standby_config[6] = {0x61,0x00,0x00,0x00,0x00,0x00};
byte read_config[6] = {0x00,0x00,0x00,0x00,0x00,0x00};

void setup()
{
  pinMode(CS0,OUTPUT);
  pinMode(CS1,OUTPUT);
  pinMode(CS2,OUTPUT);
  pinMode(DECODER_EN,OUTPUT);
  pinMode(SCKPIN,OUTPUT);
  
  Serial.begin(9600);
  SPI.begin();
  SPI.setDataMode(SPI_MODE3);
  
  digitalWrite(DECODER_EN,LOW);
  digitalWrite(CS0,LOW);
  digitalWrite(CS1,HIGH);
  digitalWrite(CS2,LOW);
  digitalWrite(SCKPIN,LOW);
  delay(1000);
  
  digitalWrite(DECODER_EN,LOW);
  SPI.transfer(WRCFG);
  SPI.transfer(WPEC);
  
  for(int i = 0; i < 6; i++){
    SPI.transfer(standby_config[i]);
  }
  digitalWrite(SCKPIN,HIGH);
  
  digitalWrite(DECODER_EN,HIGH);
  digitalWrite(SCKPIN,LOW);
}

void loop()
{
    Serial.println("Reading config registers");
  
  digitalWrite(DECODER_EN,LOW);
  SPI.transfer(RDCFG);
  SPI.transfer(RCPEC);
  digitalWrite(SCKPIN,HIGH);
  
  for(int j = 0; j < 6; j++){
    read_config[j] = SPI.transfer(0);
    digitalWrite(SCKPIN,LOW);
    delay(100);
    Serial.println(read_config[j],HEX);
    digitalWrite(SCKPIN,HIGH);
  }
  digitalWrite(DECODER_EN,HIGH);
  delay(1000);
}

What I get back is 0xFF for each config register, when I'm expecting to see 0x00. Any ideas on where to go from here?

Thanks in advance!

So, an update.

I've been sifting through resources on the internet and have pieced together some code which reads out values different from simply all 0's or all F's, but they're not the same values that I'm writing.

To make sure that I'm reading/writing to the LTC properly, I'm just writing to the setup registries and reading them back so that I know exactly what to expect. However, what I'm writing isn't matching what I'm reading which has led me to a roadblock

My current code:

#include <SPI.h>

byte config[6] = {0xE7,0x00,0x00,0x00,0xAB,0x71};

byte WRCFG = 0x01;
byte RDCFG = 0x02;

const int CS0 = 4;
const int CS1 = 5;
const int CS2 = 6;
const int DECODER_EN = 7;

//Function to calc PEC from http://calsol.googlecode.com/svn-history/r238/trunk/BMS/bps.h
byte getPEC(byte * din, int n) {
  byte pec, in0, in1, in2;
  pec = 0x41;
  for(int j=0; j<n; j++) {
    for(int i=0; i<8; i++) {
      in0 = ((din[j] >> (7 - i)) & 0x01) ^ ((pec >> 7) & 0x01);
      in1 = in0 ^ ((pec >> 0) & 0x01);
      in2 = in0 ^ ((pec >> 1) & 0x01);
      pec = in0 | (in1 << 1) | (in2 << 2) | ((pec << 1) & ~0x07);
    }
  }
  return pec;
}

void setup()
{
  pinMode(CS0,OUTPUT);
  pinMode(CS1,OUTPUT);
  pinMode(CS2,OUTPUT);
  pinMode(DECODER_EN,OUTPUT);
  
  Serial.begin(9600);
  SPI.begin();
  SPI.setDataMode(SPI_MODE3);
  SPI.setBitOrder(MSBFIRST);
  
  //set up CS
  digitalWrite(DECODER_EN,LOW);
  digitalWrite(CS0,LOW);
  digitalWrite(CS1,HIGH);
  digitalWrite(CS2,LOW);
  
  //send WRCFG
  digitalWrite(DECODER_EN,HIGH);
  
  SPI.transfer(WRCFG);
  SPI.transfer(C7);
  
  for(int i=1; i<6; i++){
    SPI.transfer(config[i]);
  }
  SPI.transfer(getPEC(config,6));
  digitalWrite(DECODER_EN,LOW);
  
  //read registers
  digitalWrite(DECODER_EN,HIGH);
  SPI.transfer(RDCFG);
  SPI.transfer(CE);

  for(int i=0; i<6; i++){
    config[i] = SPI.transfer(RDCFG);
    Serial.print(config[i],HEX);
    Serial.println();
  }
  byte pec = SPI.transfer(RDCFG);
}

void loop()
{
  // put your main code here, to run repeatedly:
  
}

Any tips would be much appreciated, thanks!