Correct setup for AD7793?

Hi,

I am evaluating AD7793 through the EVAL-CN0355-PMDZ board. In order to understand how it works I'm using the NO-OS driver found here and trying to interface it with an Arduino, but as far I can see, data is a little bit strange.

When I execute AD7793_Init(), the function does not return 1, it returns 0 meaning the device is not correctly detected.

When I read from the AVDD Monitor with these functions:

  AD7793_SetChannel(AD7793_CH_AVDD_MONITOR);
  unsigned long conv = AD7793_SingleConversion();
  float AVDD = ((conv - 8388608.0) / 8388608.0) * 1.17 / (1/6.0);
It returns a value that oscillates around 4.9V, which seems correct because I'm powering the board with 5V, also when I read the chip temperature I read the ambient temperature, which seems to be correct. The problem comes when I try to read from AIN2, I get data that is absolutely not correct.
AD7793_SetExcitCurrent(AD7793_EN_IXCEN_1mA);
AD7793_SetChannel(AD7793_CH_AIN2P_AIN2M);
conv = AD7793_SingleConversion();  /* Returns the result of a single conversion. */
float Temp = (((conv - 8388608.0) / 8388608.0) * 1.17 * 1000 / 0.810);
First I set the excitation current to 1mA, then I set the channel to read and finally I try to get the conversion. But data read varies from -1444.44 to 1444.44. Data read should be zero because I'm not using an RTD, but a resistance with a nominal value of 100 Ohm (100 Ohm correspond to 0ºC). So I think I'm missing some configuration before getting the data.
Any ideas of what I'm doing wrong?


Formatation done.
[edited by: rnicolas at 3:40 PM (GMT -4) on 17 Mar 2021]
Parents
  • 0
    •  Analog Employees 
    on Mar 18, 2021 7:26 AM

    HI, 

    May I know what external reference resistor did you use? Are you using exactly the same circuit as CN-0355 and just used 100ohm resistor in replacement with RTD? 

    I don't fully understand how the equation used was derived. But if you probe for example the 100ohm and the Rref, are you getting the actual voltage? I'd suggest to measure the data output code only and see if that reflects to the actual input voltage. We can work on the code to temp equation once we verified your schematic and configuration. 

    I think the excitation current have also an outpiut compliance. So for example you have AVDD=5V and you have used 5kohm Rref the voltage drop across Rref using 1mA current is already 5V and it violates the output compliance of AVDD - 1.1V and it do not have enough headroom for RTD. So please confirm your circuit and ADC configuration. 

    I'd also suggest to ask someone from the Reference Circuits - EngineerZone (analog.com) if you have questions specific to CN0355. 

    Thanks,

    Jellenie

  • Hi,

    Thank you for your fast answer.

    May I know what external reference resistor did you use? Are you using exactly the same circuit as CN-0355 and just used 100ohm resistor in replacement with RTD? 

    Yes, exactly, in fact, I'm using the EVAL-CN0355-PMDZ. I've attached an image so you can see it.

    I've changed the setup code by the following ones (from your driver of Renesas) adapted to use AIN2 instead of AIN1:

    AD7793_SetGain(AD7793_GAIN_1);                // set gain to 1
    AD7793_SetChannel(AD7793_CH_AIN2P_AIN2M);     // use AIN1(+) - AIN1(-) 
    AD7793_SetIntReference(AD7793_REFSEL_INT);    // select internal 1.17V reference
    AD7793_Calibrate(AD7793_MODE_CAL_INT_ZERO,
                     AD7793_CH_AIN2P_AIN2M);      // Internal Zero-Scale Calibration

    And also reduced the excitation current from 1mA to 10uA (I've seen if I use 210uA, sometimes the board gets stuck and I have to reinitialize it). Now I'm receiving values the following values:

    10001101001101010011
    10001000000011010111
    10100010011011010000
    10101111001010110111
    10100011100111001010
    10100001110101000100
    10101100011100001111
    10101100010111011010
    10100001010001111101
    10010010001010111110
    10000010100100110101
    10011110000000101010
    10100100011000101101
    10101100100100001010

    Which if I apply the formula that I put in the first post I get a value that goes around 0 ºC, but since it was a quick hack from one of my colleagues I'm not using it.

    As far I understand, these values in binary are the differential voltages on the resistor acting as PT100 in my system, right? The problem is that I don't see how to convert them to V to get then the R-value (and once I get the R I can get the temperature directly) since I know the Intensity (10uA) and Voltage (in binary form).

  • 0
    •  Analog Employees 
    on Mar 19, 2021 1:45 AM in reply to rnicolas

    Hi, 

    Okay. If you are using exactly the same configuration circuit as CN0355. Then I guess you need to update your ADC configuration in order to reflect with the circuit configuration. 

    So Ideally, CN0355 uses a ratiometric configuration wherein the same current is flowing through RTD and the 5kohm reference resistor. Meaning, any variation in IOUT or errors in excitation current will be cancelled. With a 210uA current, a 5kohm Rref will generate a 1.05V and will serve as the reference input voltage of the ADC. So Instead of using internal reference, you must configure the ADC to use external reference. Then since a 210uA is quite small, it will also generate a small voltage across your RTD so to maximize the ADC performance you should also change your Gain. I am not sure what gain the CN uses but a Gain of 16 would be fine.  

    In terms of how to convert code to voltage, you can refer to this link. 

    FAQ: How to convert the AD7124-4/AD7124-8 data output Code to equivalent analog input voltage? - Documents - Precision ADCs - EngineerZone

    And in terms of how to convert from RTD to temp, you can use CN0383 as reference. It uses a different ADC but would still apply the same calculations. I'd think I can also recommend using AD7124 instead as this is a newer part. It has all of the building blocks of AD7793 with more advanced features. We also have an RTD design tool that could help you get started. Example codes for this product is also available, and we are also planning to release example code specific to temp sensing. 

    Reference circuit: CN-0383 (Rev. C) (analog.com)

    RTD Tool: https://www.analog.com/media/en/designtools/calculators/rtd_configurator_and_error_budget_calculator-rel1.0.0.exe 

     Sample code: 

    Sigma Delta ADC Temperature-BLE Demo [Analog Devices Wiki]

    AD7124 Example on STM32 Processors [Analog Devices Wiki]

    Thanks,

    Jellenie

  • Hi,

    I've just set up the project with those values you mentioned. But still, data read from the ADC is strange for me because when I calculate the R, R has a value that does not correspond with the expected ones, but before going deep into that I would like to see if I understand correctly the different parameters.

    According to this link, the formula is the following one:

    Code = (2^N × AIN x Gain)/VREF

    In my case, since I'm using AD7793, the values that I need to use are these ones:

    N = 24

    AIN = ??? (the value that am I searching for?)

    Gain = 16

    Vref = 1.05V (Voltage drop in Rref)

    Code = the value read when I call the AD7793_SingleConversion() function (is that right?).

    So, when I substitute these values in the formula and I isolate AIN, I get this:

    AIN = (Code*Vref)/((2^n)*GAIN)

    AIN = (1414464*1.05)/(16777216*16)

    AIN = 1485187.2/268435456

    AIN = 0.0055327 (I assume this is the voltage that drops in the RTD).

    And this value is not correct because V=I*R, so:

    0.0055327/0.00021 = 26,34 Ohms, which is not possible because instead of an RTD I am using a 100Ohm, so I should get a value around 100 Ohm, not around 25 Ohm.

    EDIT:

    I've also done the math using the bipolar formula because it is the default mode. I've applied the formula in the document, but data is still not correct. The only configuration that I've found to get some reasonable data is using a Gain of 32, which I get 106 Ohms in R, but again, this is not acceptable because 106 is the equivalent to 15ºC (which is an error about 15ºC from the data that I should be monitoring).

  • 0
    •  Analog Employees 
    on Mar 23, 2021 3:26 AM in reply to rnicolas

    Hi, 

    Have you probe the RTD and see what input voltage are you seeing? Can you also check the links, P9 for example and ensure that it is not shorted? 

    And one more thing can you confirm that you have configured the part correctly. So for example writing and reading back to a certain may confirm that your interface is operating correctly. Can you confirm if you are configured in unipolar or bipolar mode so you'll know what appropriate formula should be use. 

    So can you readback the Mode, Configuration and IO register? This is just to confirm that you have configured the part correctly. 

    Thanks,

    Jellenie

Reply
  • 0
    •  Analog Employees 
    on Mar 23, 2021 3:26 AM in reply to rnicolas

    Hi, 

    Have you probe the RTD and see what input voltage are you seeing? Can you also check the links, P9 for example and ensure that it is not shorted? 

    And one more thing can you confirm that you have configured the part correctly. So for example writing and reading back to a certain may confirm that your interface is operating correctly. Can you confirm if you are configured in unipolar or bipolar mode so you'll know what appropriate formula should be use. 

    So can you readback the Mode, Configuration and IO register? This is just to confirm that you have configured the part correctly. 

    Thanks,

    Jellenie

Children
  • Hi,

    P9 is not shorted. P3 and P4 are shorted. I can read from AVDD Monitor Channel, and I get around 5V, which is ok since I am supplying 5V. I can also get the temperature through the Temperature Channel, which is 21ºC in my office, and it is the value that I get from the sensor. So, at this point, I'm quite sure the communication to the board is working.

    Now I've replaced the RTD with a multimeter to check the current source that it is giving to me, and it's giving 37uA when it should be giving 210uA. If I configure the AD7793 to output 10uA, I get only 1.8uA, and 1mA, I get 180uA.

    If I try to read the registers with the function inside the drivers AD7793_GetRegisterValue(AD7793_REG_MODE, 2, 1);

    AD7793_GetRegisterValue(AD7793_REG_CONF, 2, 1);
    AD7793_GetRegisterValue(AD7793_REG_IO, 1, 1);

    I receive random data that doesn't follow any pattern, and after 30 seconds of reading those registers I get a stream of 1s.

  • 0
    •  Analog Employees 
    on Mar 24, 2021 5:19 AM in reply to rnicolas

    Hi, 

    I am not familiar with the reference driver so might worth asking on how to use it in the (+) Microcontroller no-OS Drivers - EngineerZone (analog.com). But technically in order to readback a certain register you just need to write to communication register specifying a read to the mode register or IO register, for example and then the ADC knows that number of SCLK pulses that are required to clocked the data. So after writing you just need to supply the appropriate number of SCLKs. The datasheet shows how to write to the communication register and also shows each registers address. 

    The current ratio to the programmed and to the actual measured seems to be consistent, so I am wondering what might have causing the issue. If you can verify the register settings then we can narrow down the issue with the hardware setup. I was actually thinking that there could be a misconfiguration in the ADC, a vbias must be accidentally enabled for example or burnout currents. So it is really helpful to readback all of the register settings to confirm that the ADC is setup correctly.  

     Thanks,

    Jellenie

  • Hi,
    First of all, thank you for your time and patience. You have been very helpful all these days. But yesterday, we found data was completely incongruent. We were reading the AVDD and temperature channels and we were getting data like -7 V (we were powering the board with 5V) and a temperature of 157777 or something like that. So we think the board (or some part of it) is dead. We will contact our supplier to know how to proceed.
    I think there is nothing more you can do at this point. Again, thank you a lot for your guide and your suggestions. They were very helpful.

  • 0
    •  Analog Employees 
    on Mar 25, 2021 10:39 AM in reply to rnicolas

    Hi, 

    I would also recommend to ask someone from the Reference Circuits - EngineerZone (analog.com) They have design this board so they may be able to help you debug the hardware.

    I think one way to confirm if the ADC is converting is to just power up the part, do not write or read to/from any registers. Just power up the part with correct analog and digital supply, then pull CS low, monitor the DRDY pin via scope and see if it is pulsing at default ODR. 

    Thanks,

    Jellenie