AD7124-8 for Arduino Due

I have been trying to find a piece of code to communicate to AD7124-8 with Arduino Due. I tried to use:

AD7124 No-OS Software [Analog Devices Wiki] 

The piece of code in this page under "AD7124 Driver":

no-OS/drivers/ad7124 at master · analogdevicesinc/no-OS · GitHub 

require a library for SPI communication library having spi_init(), spi_read(), and spi_write() functions. The SPI communication library under "Communication Generic Driver":

no-OS/common_drivers/communication/generic at master · analogdevicesinc/no-OS · GitHub 

is empty and it is supposed to be written for the used processor. 

Can anyone help me to define these functions for arduino Due or is there any piece of code available already to communicate between arduino Due and AD7124-8.

  • Hi,

    Yes, the communication driver is where the specific communication functions for the desired type of processor and communication protocol have to be implemented. We only provide code to control and initialize the AD7124 part but we don't provide any actual details for a specific communication protocol to the ADI driver. The communication driver has a standard interface, so the AD7124 can be used without modifications, with any microcontroller. 

    Thanks,

    Jellenie

     

  • I am trying to talk to AD7124-8 through SPI on Arduino Due. I am just going to read the ID register to make sure communication is set up. Here is the code I have used: 

    digitalWrite(SS1,LOW); //Serial Select Low
    delay(10);
    SPI.transfer(0x00); //Transfer Communication Register Address
    SPI.transfer(0x40 | 0x05); //Tell Communication Register you are going to read ID register
    value[0] = SPI.transfer(0x00); //Get data from Communication Register
    digitalWrite(SS1,HIGH); //Serial Select High

    delay(10);

     

    I have monitored SPI by a logic analyzer and I am just getting zero. 

    I can not find what is wrong to read AD7124-8 ID?

    Kaveh

  • Remove the initial "SPI.transfer(0x00);".  The device starts up and expects the first command to be a write to the comms register, but you don't need to explicitly write to the 0x00 register.  Just send your 0x45 command (which will be interpreted by the device as a write to the comms register, requesting a read for register 0x05), then your 0x00 transfer to get the response back.

  • Thanks for the helpful comment. I removed the SPI.transfer(0x00) and changed the code to:

    digitalWrite(CS1,LOW); //Serial Select Low
    delay(10);
    SPI.transfer(0x40 | 0x05); //Tell Communication Register you are going to read ID register
    value[0] = SPI.transfer(0x00); //Get data from Communication Register
    digitalWrite(CS1,HIGH); //Serial Select High
    delay(10);

    I am now getting a non-zero output 0x12, but the ID register value is 0x14. I think there is still something wrong.

    Kaveh

  • I am now getting a non-zero output 0x12, but the ID register value is 0x14. I think there is still something wrong.

    How old is your chip ?  There was a revision to the silicon in the middle of last year, which resulted in the ID changing from 0x12 to 0x14.  See discussions here: AD7124 ID Reg  and  AD7124-8 ID reg