title: How can i use SPI on Arduino Due to communicate with AD7124-8 correctly
body: <p>I want to read data from AD7124-8 with arduino Due via SPI. I found several libraries, but i dont get anything back from my ADC modul. By using an Oscilloscope i made sure my Arduino sends data via MOSI, SCK and CS work aswell. Just the MISO dataline doesnt get me anything back.</p>
  <p>I first used this library (<a href="https://github.com/NHBSystems/NHB_AD7124" rel="nofollow noreferrer">https://github.com/NHBSystems/NHB_AD7124</a>), but decided to use a much easier Code to just make sure everything is working fine. I tried to to talk to the communication register to get the ID of my device from the ID register. You can find the registers on page 39 of the datasheet :<a href="https://www.analog.com/en/products/ad7124-8.html" rel="nofollow noreferrer">https://www.analog.com/en/products/ad7124-8.html</a> .</p>
  <p>Im sending 0x00 and 0x05 to get back the 0x14 which should be the correct ID. Just zeros arriving (shown by Osci).
  I found a solution in a Forum, but im not sure about why it differs with the data sheet:
  <a href="https://ez.analog.com/data_converters/precision_adcs/f/q-a/24046/ad7124-8-for-arduino-due" rel="nofollow noreferrer">https://ez.analog.com/data_converters/precision_adcs/f/q-a/24046/ad7124-8-for-arduino-due</a>
  when i use it the code stops running at the Line: value[0] = SPI.transfer(0x00);
  They send 0x40 at the beginning, too.</p>
  <p>Here my simple Code:</p>
  <pre><code>#include &lt;SPI.h&gt;
  
  // Physical Pins
  const int csPin = 10;
  int value[7] {0};
  
  void setup() {
    Serial.begin (9600);
    pinMode(10,OUTPUT);
    SPI.begin(10);
    
    SPI.setClockDivider(10, 128);
    SPI.setDataMode(SPI_MODE3);
  }
  
  void loop() {
    digitalWrite(csPin, LOW);
    //SPI.transfer(csPin, 0x00);
    SPI.transfer(csPin,0x00,SPI_CONTINUE); //Tell Communication Register you are going to read ID register
    SPI.transfer(csPin,0x05);
    //SPI.transfer(csPin,0x00);            //Get data from Communication Register
    delay(1);
    digitalWrite(csPin, HIGH);
    delay(1);
    Serial.print(value[0],HEX);
  }
  </code></pre>
  <p>I hope someone can help me out.
  Greetings</p>