Post Go back to editing

CN-0349, gain factor

Hi Guys,

I'm trying to write a C code for a Renesas micro to interface the EVAL-CN0349-PMDZ.

Referring to the Circuit Note document enclosed to the board, page 4, equation 1, I can't understand what "code Nx" parameter stands for.

It seems to be the ADC result related to the calibration impedances Yx, but the AD5934 gives back the real and imaginary datas, so which data I have to use to calculate the gain factor ?

Thank you


  • The calibration procedure you are referring to is discussed in terms of the admittance (the inverse of impedance) absolute value Y. To calculate N from the Real and Imaginary data in the chip output registers the described procedure requires user to calculate absolute value of the chip output: N = SQRT (Re^2 + Im^2), which can be used in the formulas.

    If you sweep a wide frequency range and since you seem to have reasonable computational power in your microcontroller it might make sense to simply calibrate gain at every frequency point in your sweep and store it as an array to later calculate the unknown impedance.

    Best of luck!

  • Hi Snoriax,

    thank you for your help.

    So, in the equation GF= (Yh-Yl)/(Nh-Nl), Nh and Nl are the magnitudes calculated with their own calibration resistors. Ok, that's clear.

    I'm using a little micro (R5F21114, just 16k flash and 1k RAM) I'm already using for other purposes, so actually I don't have a great computational power.

    What I'm trying to do now just for test, is measure a resistor. So, what I though I was doing is calibrate the system with the two point calibration method (using 0x12 and 0x22 as register values for ADG715) without the sweep frequency but only using a 2kHz segnal, than measure the unknown resistor with the same signal.

    Do you think it is a wrong method ?

    Thank you,




  • Yes, the "Y"s are inverse resistances and the "N"s are the correspondent magnitudes of the complex-valued AD5934 output.

    You do not have much computing power to spare indeed (thought you had a dedicated microcontroller).

    Personally, I find the the proposed calibration procedure unnecessarily complicated: if you do not connect anything the resistance is infinity, the corresponding Yl is 0 and Nl is also 0. You do not need the second resistor at all - connecting nothing works better as you do not need to worry about the accuracy of Yl and and you know what Nl is supposed to be (you will certainly see a bit of noise in Nl, but that is a useful measure of the accuracy you can expect from your system).

    Yh for calibration is also pretty much determined for you by the system: it has to be about the same value as 1/Rfb selected by the switch U1, which is R9, R8 or R6. So, if you calibrate with R3, R4 and R7 the Rfb of R9, R8 or R6 should be selected respectively (assuming that R6 of 10k is installed on your board).

    To summarize: as an example, select R8 as Rfb and R4 as Rcal, calculate your gain as GF = Yh / Nh, then connect the "unknown" resistor Rx that should be larger than R8, read the output Nx and calculate the "unknown" resistor value 1/Rx = GF * Nx - the result should be close to the resistor nominal value.

    Nothing is wrong measuring at a single frequency. Give the chip a non-zero Number of Settling Cycles (seems to choke otherwise) and wait 7-10 ms between enabling the output voltage from the chip and taking measurements to allow the high-pass filter C1(R1||R5) to settle. 

    Best of luck!

  • Hi,

    It doesn't work.

    I've tried all day long, but it doesn't work.

    I don't know what I'm doing wrong, but I'll continue to study.

    Thank you for you help



  • Things should go smoother once you are able to read/write from/to the AD5934 chip. There are some code examples floating on the web, you might consider reviewing those not to reinvent the wheel. Here is one on GitHub, and a few more. Those are for the AD5933, but the commands and functionality are virtually identical, except your AD5934 does not have built-in internal oscillator and temperature gauge.

    Best of luck!

  • The comunications are ok, AD5934 receives and transmits very well.

    The problem is the content, the data I read is not what I want.

    Probably there is still something wrong with the setup or with the timing.

    Now I can see on a display the value of the impedance calculated, and this value is different every time (with a 10k resistor as load).

    I've already found examples wrote for the AD5933, I used them for my source. Now I'll check your links.

    Thank you,



  • Yes, it looks like it is your battle to win - impossible to help you debugging remotely. Make sure that Number of Settling Cycles (0x8A and 0x8B) is not zero - that could cause the erratic readings you describe, but there might be quite a few other issues, like the switch U1 is not connecting as you expect, etc.

    Also you can always disconnect the load (but not the Rf) completely and see how Nl behaves - it should be near zero with some noise of 5-10 counts.

    Best of luck and, most importantly, stay healthy!

  • Good morning Snorlax,

    Reading the examples wrote for the AD5933, I've noted that there isn't any waiting time between the steps of the configuring sequence.

    For example, in the function AD5933_GetRegisterValue there is a reading command immediately after a writing command.

    I suppose that the AD5934 needs a little bit of time to set its internal registers.

    Since it has 1MHz clock and my micro has 16MHz clock, I think I'm too fast sending the commands.

    Do you know how long AD5934 needs to handle the configuring commands?

    In other words, after a command, how long I have to wait before send the next command ?

    I'm searching this data in the data sheet but I don't find it.




  • In my personal experience I never needed to wait between sending I2C commands to chips progammatically - timing was handled properly by the I2C interface. Occasionally I2C would not work well without pull-up resistors on SCL and SDA lines or there was a mismatch between the speed of devices on the same I2C bus. Does your EVAL-CN0349-PMDZ have the pull-up resistors installed on SCL and SDA lines (R14, R15, R16 and R17)?

    The AD5934 is supposed to work at up to 400KHz speed. You can certainly try reducing the speed down to, say, 100KHz on your microcontroller side and see if the problem goes away.

    If you have access to an oscilloscope it would be worth trying to see if you have sharp transients between bits on the SCL ans SDA lines at the AD5934 pins when you communicate with it.

    Best of luck!

  • Hi,

    I'm not referring to the I2C timing, but the time eventually needed by the AD5934 to handle the commands.

    For example, to write a data in an eeprom, you send the command, the data, the eeprom answers ACK, then it needs few milliseconds to store the data into the memory. The eeprom ignore any other command till the end of the write procedure.

    I'm asking if something like this happens also with the AD5934 sending the configuration parameters.

    Answering your question, yes, the pullup resistors are present.

    Thank you


    Stefano Dini