Post Go back to editing

CN0510 calibration reporting integers

Category: Software
Product Number: cn0510

Hi there,

I am not getting repeatable values from the BAT_IMPEDANCE example. this is the result after trying 12 consecutive runs. All over the place:

This is my test set-up:

The calibration results are giving integers and appear to be nonsense

Freq Vexcite Vcal
10.00 3.000 0.000
16.68 3.000 0.000
27.83 3.000 -1.000
46.42 -4.000 -7.000
77.43 0.000 -1.000
129.15 -1.000 -1.000
215.44 -1.000 0.000
359.38 2.000 1.000
599.48 -2.000 13.000
1000.00 2.000 13.000

What I've tried:

 - the basic sample here:

https://github.com/analogdevicesinc/ad5940-examples/tree/master/examples/AD5940_BATImpedance

 - adding the extra params to the struct mentioned in fig here:

https://wiki.analog.com/_detail/resources/eval/user-guides/circuits-from-the-lab/cn0510/serial-terminal.png?id=resources%3Aeval%3Auser-guides%3Acircuits-from-the-lab%3Acn0510

 - pasting in the code here:

https://ez.analog.com/reference-designs/f/q-a/558951/cn0510-batz-frequency-inconsistency/465899?queryID=6cdfcae6848782175348960c6a40f782

I guess something is wrong with my ADC.  What options do I have to troubleshoot?

Thank you, take care,

Parents
  • Hi,

    Could you check with Sensorpal GUI as it has default AFE parameters ideal for battery measurement.

    By calibration output, do you mean the RcalVolt values displayed in the beginning as below:

    Rcalvolt gives Vrcal = current through Rcal X RTIA

    where,

    RTIA = feedback resistor of HSTIA 

    Vrcal is shown in Cartesian format.

    It is not clear what you meant by Vcal and Vexcite.

  • I shifted over to the embedded approach because we werent getting anything that looked reasonable from sensorpal

    Here's a result  I took just now using sensorpal on the same battery.  While not as messy, it still seems like nonsense.  Except for the first frequency measurement, the values all say -500milliohm.

    https://imgur.com/a/XovrRvM

    this battery has an open circuit voltage of 4.8V.  According to SensorPal, the DC bias cannot be set above 1200mV.  What is the DC bias referring to?

    ------------------------

    For the calibration , yes, those numbers are what I was referring to.  Based on the description I read in the manual, I had the impression that it was doing some form of voltammetry.

    Can you send some kind of paper describing the maths behind the HSTIA calculation and polar coordinates you mention?

    I thought it was referring to the 50mohm calibration

  • Your actual question is this: "I am not getting repeatable values from the BAT_IMPEDANCE example"

    This is not my question.  This is certainly the context for why I am asking the question.  I asked my original question (and those that followed) in the course of troubleshooting the lack of repeatability (in both SensorPal and via flashing).

    I can appreciate that you need me to check things from your side, but I don't appreciate you declining to answer my questions and instead making me provide a bunch of extra data supporting what I've already told you.

    "The RcalVolt displayed is just the DFT output (content of DFTReal and DFTImag registers). 

    Right, this was understood. So I'll state what I understand again:

    a) if DFTReal & DFTImag are both 0 (as can be clearly seen across multiple frequencies in my results), then no signal is being received/reported by the ADC. 

    Do you dispute this point?

    b) if DFTReal and DFTImag are both the integer register value, then the actual amplitude needs to be converted to voltage via the conversion calculation you mentioned and an amplitude of 1 (ie the hypotenuse of DFTReal & DFTImag) is the smallest quantization value measurable by the ADC.

    Do you dispute this point? 

    I certainly might be wrong on a &/or b, but this is what I understand from what you've explained to me.

    Then I asked if the DAC values are available in a register, so I could attempt to compare.  I'm still waiting on a response to that.

    These are clarifications about hardware details which I need in order to dig into the code.  I would've been happy to look through a reference doc that lists the registers, but I'm not aware of one.

    However you are going in circles asking why DFT Imag is not "0".

    This was never my question.  I am getting 0 for BOTH DFTReal & DFTImag across several frequencies.

    ------------

    I have now run the alternative code.  I will post them in a second response a little later.  Here's a hint though, both code samples are yielding 0 or almost 0 magnitude in the middle frequencies, in agreement with the data already posted above in past days.

    I've also run a git diff on the new code you sent against what is in github.  there is no difference between what you sent and the github code (other than a couple parameters within the struct).

    ADCPgaGain is defined in AD5940.h

    Thank you, I see this variable now

  • 1) if DFTReal & DFTImag are both 0 (as can be clearly seen across multiple frequencies in my results), then no signal is being received/reported by the ADC.

    I hope you are aware that if a battery is connected in reverse polarity, no current flows through RCAL, hence gives 0 in all RcalVolt entries. 

    Also, the RCalVolt displayed in terminal is the DFT (Discrete fourier tranformed) output. It can very well have 0 entries if measured input doesn't have component at that frequency.

    2) you mentioned and an amplitude of 1 (ie the hypotenuse of DFTReal & DFTImag) is the smallest quantization value measurable by the ADC.

    I don't know where you got this from as didn't mention any of this. Volts calculated by formula below is the instantaneous voltage measured by ADC.

    It is not amplitude of the sinusoidal voltage(= magnitude obtained by hypotenuse of DFTReal and DFTImag)

    Volt = ((ADCcode - 32768)/32768)*(ADCRefVolt/ADCPgaGain)*kFactor

    3) I would've been happy to look through a reference doc that lists the registers, but I'm not aware of one.

    The AD5940 datasheet and CN0510 appnote contains all information required to measure battery impedance , which is obvious reference.

    (https://wiki.analog.com/resources/eval/user-guides/circuits-from-the-lab/cn0510,

    AD5940 Datasheet)

    4)I asked if the DAC values are available in a register, so I could attempt to compare.

      It is the content of HSDACDAT register. However as mentioned several times, this CE0 voltage is not measured by ADC and DFT block in the BATZ code. 

    5) why DFT Imag is not "0" was never my question.

    You are assuming everywhere that DFTImag = 0. I am not sure why.

    5) I've also run a git diff on the new code you sent against what is in github.  there is no difference between what you sent and the github code.

    Again I have to highlight to you that I shared the LIB FILES, NOT the BATZ EXAMPLE CODE.

    I hope you take assistance from your software engineer on software queries.

  • I hope you are aware that if a battery is connected in reverse polarity, no current flows through RCAL, hence gives 0 in all RcalVolt entries. 

    We already went through this, when reverse polarity, ALL frequencies are 0.  That is not my problem.  My problem is that a range of frequencies in the middle range are 0.

    Also, the RCalVolt displayed in terminal is the DFT (Discrete fourier tranformed) output. It can very well have 0 entries if measured input doesn't have component at that frequency.

    In the general case, sure, 0 amplitude is a 'valid' result.  In the calibration circuit.  If the DAC is functioning properly, then a measured waveform with 0 amplitude could mean:

    a. the impedance is infinity OR

    b. the adc is not failing to measure the signal.

    Can you give an explanation for a 0 amplitude measured signal when the circuit is functioning correctly?

    I don't know where you got this from as didn't mention any of this. Volts calculated by formula below is the instantaneous voltage measured by ADC.

    It is not amplitude of the sinusoidal voltage(= magnitude obtained by hypotenuse of DFTReal and DFTImag)

    Volt = ((ADCcode - 32768)/32768)*(ADCRefVolt/ADCPgaGain)*kFactor

    The hypotenuse of DFTReal and DFTImag is amplitude of the measured waveform (in bits).  Is it not?

    That measurement (in bits) is converted to volts, via the formula mentioned.  Is it not? 

    If not, then please clarify what it is instead.

    The AD5940 datasheet

    Ok, I see the LPDACDAT0 & HSDACDAT registers.  Thank you for that.

      It is the content of HSDAC register. However as mentioned several times, this CE0 voltage is not measured by ADC and DFT block in the BATZ code. 

    Yes, I realize this.  I will show you what I mean soon enough.

    You are assuming everywhere that DFTImag = 0. I am not sure why.

    It's not an assumption, this is what my CN0510 is reporting to me and which I've reported to you in my data above several times now.

    Again I have to highlight to you that I shared the LIB FILES, NOT the BATZ EXAMPLE CODE.

    Yes, this is what I compared. The files located here:

    https://github.com/analogdevicesinc/ad5940lib/tree/d4c2ba01f0c1f8cb47264905407a4a3f7bf1cd47

    I hope you take assistance from your software engineer on software queries.

    I am the senior software engineer on my team.  I have to drill down into the code because my board is having an issue out of the box that appears to me like abnormal behaviour.

    Based on your responses, you seem to still disagree.

    So I am going to repeat what I see as the problem:

    The data posted on Mar 16 shows a range of frequencies (not all frequencies) with a received/measured waveform or 0 amplitude.  I believe this indicates some kind of hardware issue.

    Do you see what I see in that Mar 16 data?

  • This is the default link for current github lib files: https://github.com/analogdevicesinc/ad5940lib (1)

    What I shared above is different from this lib file. (2)

    You are using a lib file in Github branch which is different from both (1) and (2) files.

    1) "Can you give an explanation for a 0 amplitude measured signal when the circuit is functioning correctly?"

    In your plots, wherever Real part is zero, imaginary part is non-zero.

    Hence RCALVolt magnitude is finite non-zero in all your RCALVolt readings.

    You have shown  Rcal voltage reports (0, 0) only in reverse polarity case. 

    2) "measurement (in bits) is converted to volts, via the formula mentioned.  Is it not? 

    If not, then please clarify what it is instead"

    Volts calculated by formula is the instantaneous voltage measured by ADC.

    It is not amplitude of the sinusoidal voltage.

    Amplitude of voltage across RCAL is just value obtained by hypotenuse of DFTReal and DFTImag in unit Volts.

  • This is the default link for current github lib files: https://github.com/analogdevicesinc/ad5940lib (1)

    What I shared above is different from this lib file. (2)

    You are using a lib file in Github branch which is different from both (1) and (2) files.

    Ok noting this.  That link was just what came up in my browser history.  I'm pretty sure the code on the lab computer is on the master branch.  But I will need to double check tomorrow.

    If the code you shared is intentionally different from what's on github, then copy/pasting into keil saving, recompiling and reuploading did not successfully save the file in such a way that git picked up the changes.  I must admit that I am quite new to keil, so maybe I made an incorrect assumption about how keil handles files or something.  I will investigate further tomorrow.

    In your plots, wherever Real part is zero, imaginary part is non-zero.

    Hence RCALVolt magnitude is finite non-zero in all your RCALVolt readings.

    You have shown  Rcal voltage reports (0, 0) only in reverse polarity case. 

    XLSXXLSX

    You will see that calibration run in both files has a magnitude of zero for 6 to 12 out of 50 frequencies.

    However, there's also good news actually! On one out of 6 test runs today, I got something resembling a curve.  So now I'm looking at maybe a flaky connection.  I'll investigate more tomorrow.

    However, even if this whole time, it was just flakiness in the alligator clip (or similar), that doesn't resolve the 0 magnitude calibration values.

    Volts calculated by formula is the instantaneous voltage measured by ADC.

    It is not amplitude of the sinusoidal voltage.

    Amplitude of voltage across RCAL is just value obtained by hypotenuse of DFTReal and DFTImag in unit Volts.

    Each measurement within the series stored in the ADCDAT register is instantaneous, correct.  But then when the DFT is calculated, the result is an series of amplitudes (at different frequencies) in the same units as the measured series. So if the measured series is in bits, so is the DFT amplitude. so they get converted into voltage via the same ADC conversion equation.

    Strictly speaking, the DFT produces an array of the same size as the measurement series.  However, we are controlling the input series to be a dirac impulse.  Therefore the output signal should also be a dirac impulse and we only care about the amplitude of the impulse and disregard all the other points.  That's why the DFT only produces a single, complex value.

    If you think I'm mistaken about any of the above, please let me know.

  • Good evening Akila,

    Good news!  I'm now getting repeatable measurements which seem at least plausible considering the circuits involved.

    Impedance of the calibration circuit now has a magnitude of: 

    with NiMH cell - 410-bits (-1.208V)

    open-circuit - 23-bits (-1.222V) *if my conversion is correct*

    and the curves behave reasonably.

    -------

    Now both of my calibration responses are much larger than what you showed in your screenshot from Mar 6. I plotted them in one of the tabs for comparison.

    Does the calibration data now being reported look reasonable to you?

    Here's the data:

    XLSX

    I honestly don't know what happened.  It was just working when I tried to run my first tests on arriving in the lab this morning. The device was with me the whole time. Nobody else touched it.

    --------------

    This is the default link for current github lib files: https://github.com/analogdevicesinc/ad5940lib (1)

    What I shared above is different from this lib file. (2)

    You are using a lib file in Github branch which is different from both (1) and (2) files.

    I see now that i didn't notice the changes in git diff because the lib is a submodule.

    However, both code samples are now measuring correctly. Not at all similar to what I posted on Mar 13

    ----------

    You will notice if you check the 'sensor pal' tab though, that sensor pal is still reporting gibberish on this device.  But I'm not going to chase that for now.

    -----------

    I spent some time trying to re-trace my steps and reproduce the earlier erroneous results.  After everything I tried today, I was still getting repeatable, reasonable results

    Maybe it was a corrupted build artifact or something.  At any rate, I'm very glad to see this now working. 

    Thank you for all of your assistance.  I'm going to open a PR suggesting a slightly different serial output that might help someone new to the device have a better clue as to what is going on.

    Take care,

    Allan

  • Hi

    Please consider the following PR which adjusts the reporting format of the calibration data:

    github.com/.../37

    In addition, could you please have a look at the plots in the spreadsheet from my last post and either confirm or reject that the measured calibration values are within the range of expectations for a single cell and also open voltage?

    Thank you, take care

  • The shape of nyquist plot and Calibration voltage plot looks correct.

    I can't comment on the exact values obtained as it is specific to the battery. However the values for within allowed range since the shape is correct.

  • Thank you Akila,

    Good to here, I was mainly focusing on the calibration with this question so no problem about the nyquist plots

Reply Children
No Data