Post Go back to editing

AD7928 Interfacing with Arduino

Category: Hardware
Product Number: AD7928
Software Version: Arduino - VS Code

Hello, I am trying to interface AD7928 with Teensy (Arduino Framewok) using the SPI Communication. My goal is to read 8 sensors with this ADC

  1. I set the SPI Mode to 2 for this communication as the Data clocks out on the DIN line at the falling SCLK cycles
  2. I wrote the Poweup mode function as shown in Figure 24 and Page 22 of the datasheet and towards the end I set the Control register to read channel 0 for the conversion.
  3. I do not intend to use the SEQ and Shadow at this point as they seemed to complicated for a beginner.
  4. I am following the Normal mode operation indicated in Fig 22 and the schematic in Figure 11.

I have the following function code to read all the sensors and update a global array that stores the analog value : ADCout[8] is the global array storing the the converted values.

The powerup mode already sets the channel address in the Control register to Vin0; hence at the end of the 7th iteration, the channel address is reset to Vin0;

void readAD7928All()
{ // By default read all 8 pins

  int digValue[8];

  u_int16_t ADC_Mask = 4095; // 0b0|AD2|AD1|AD0|0000 // Mask to isolate converted output

  // Step 1 : read channel 0 and move onto next until the end

  for (int itr = 0; itr < 8; itr++)

    // Write Control Register for next and read the first channel

    byte Ctrlreg1_mask = 0b10000011;
    byte Ctrlreg1;
    byte channelBits;

    if (itr == 7)
      channelBits = 0 << 2;                   // Channel Bit for next capture : reset channel bit to 0 for last channel
      Ctrlreg1 = Ctrlreg1_mask | channelBits; // Including ADD2-> ADD0
      channelBits = (itr + 1) << 2;             // Channel Bit for next capture
      Ctrlreg1 = Ctrlreg1_mask | channelBits; // Including ADD2-> ADD0

    // Byte 2: SHADOW | DON’TCARE | RANGE | CODING | - | - |- |-
    byte Ctrlreg2 = 0b00000011;

    u_int16_t CTRLReg = Ctrlreg1 << 4 | Ctrlreg2; // Control Register Stored as 16-bit

    // Transfer Begin
    SPI.beginTransaction(SPISettings(1000000, MSBFIRST, SPI_MODE2));

    // noInterrupts(); // disable interupts to prepare to send address data to the ADC.
    digitalWrite(ADCChipSel, LOW);

    digValue[itr] = SPI.transfer16(CTRLReg<<4); // Transfer and capture the reading

    digitalWrite(ADCChipSel, HIGH);

    // interrupts();

    // Transfer Complete
    digValue[itr] = digValue[itr] & ADC_Mask;
    ADCout[itr] = float(digValue[itr]) * 2.5 / 4096;

The ADC output determined this way is very random. I even connected the 4 SPI channels to the Oscilloscope and I get random output from the ADC. I seek help here to improve my understanding and help me acquire the signals using this ADC

Thank you.

Yellow - CS; Turqoise - SCLK; Pink : DIN, Blue - Dout - I was trying to read channel 0

Top Replies

  • Hi  ,

    I'll contact the product owner and get back to you.


  • Hello @Nathan T ,

    I partially have resolved the issue. Since I am interfacing with a microcontroller, according to page 20 and Figure 20 of the Datasheet, the VDrive has to be supplied with 3.3V and the ADD has to be supplied with 5V. I was mislead by the specification given in Page 7. Now I understand that VDrive sets the Logic High and Low when interacting with the microcontroller. The Digital high and low from Teensy are 3.3V and 0V. Hence, when I changed VDrive to 3.3V, I was able to record correct voltage values.

    Another query I have is VRefIn is mentioned to be strictly 2.5V. But the Absolute Maximum range for this value is ADD+0.3V. Could I still operate this with a 3.3V Reference or is it absolutely necessary to be held at 2.5V. Please let me know your thoughts on this issue.



  • Hi  ,

    Sorry for the late response. Regarding your query about VRefin, the device should have a 2.5 V voltage reference to have an optimal performance. Since the parameters shown in its specification table has a reference voltage of 2.5 V. You can also refer to its pin function description, on page 11.

    Let me know if you still have other concern so that I could further assist you.


  • Hi ,

    I have a follow up question for the external ADC reference for this chip. Initially I was using the ADR4525 (this gives a PWM output) as the reference voltage for the AD7928 in hopes of getting a stable reading of the signal. However my signal read in was prettly noisy. I am curious about the kind of voltage reference (is it DC using an LDO or PWM) in chips that have an internal reference?

    Can I just use a DC 2.5V for this purpose and have a cleaner signal or do you have an other recommendations?

    Kind regards,