This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

INA226: Current Register Values Incorrect

Part Number: INA226

Hello, I'm having a bit of an odd issue with my INA226.

I'm setting up the device to be able to measure max 10A over a 150mOhm resistor.

Using the datasheet, I came up with a Current LSB value of 0.000304761904761905 A/count, and a calibration register value of 112 (0x0070).

I am setting the calibration register, and upon reading it, I see that it Is correctly set to 0x0070.

Next, I want to do a current measurement. I know that my target device is drawing about 20mA.

Checking the shunt voltage register, I get 0x03BC (956). Multiplying by the constant 2.5uV, I get 2.39mV. Dividing this by 150mOhm gets me 0.01593 Amps, which seems correct.

But, if I now do it the "correct" way, by reading the Current register instead of the shunt voltage, I'm seeing 0x3448 (13384). I would expect to see (0x03BC * 0x0070 / 2048), which would be 52.28. If I got this, and multiplied by my factor of 0.000304..., I would see about 15mA again. But the actual current register value * my multiplier (0x3448 * 0.000304...) gives over 4A!

What am I doing incorrectly?

Thanks!

  • Hello Cai,

    We are currently looking into this. Thank you for choosing TI.

    Sincerely,
    Peter Iliya
    Current Sensing Applications
  • Hello Cai,

    Thank you for including your LSB calculation and Calibration, Shunt Voltage, and Current register values; they have been helpful in approaching a solution.

    The INA226 continuously measures the shunt voltage and uses an equation to calculate current from that value. The result in the register directly depends on the programmed value in the calibration register and the measured value in the shunt voltage register, as shown in equation 3 of the datasheet (page 15, http://www.ti.com/lit/ds/symlink/ina226.pdf#%5B%7B%22num%22%3A96%2C%22gen%22%3A0%7D%2C%7B%22name%22%3A%22XYZ%22%7D%2C0%2C129%2C0%5D).

    We would like a few more parameters in order verify the calculations. Could you read and please provide the values in all 10 registers?

     

    Best,

    Manuel Chavez

  • Ah, I think we may have found the issue. It appears to be a byte order problem.

    i2cdump -r 0-7 -y 1 0x48 w
         0,8  1,9  2,a  3,b  4,c  5,d  6,e  7,f
    00: 2741 bd03 bf0e f909 8e34 0070 0800 0000

    i2cdump -r 0xFE-0xFF -y 1 0x48 w
         0,8  1,9  2,a  3,b  4,c  5,d  6,e  7,f
    f8:                               4954 6022

    The i2cdump program is reading the byte order backwards (FE is actually 0x5449)

    This also means that my calibration register value is backwards (0x7000 instead of the necessary 0x0070). Looking in my code, I swap all reads and writes internally except for setting the calibration value write. Correcting this, I am now getting values that look reasonable.

    I probably should have checked this myself before bothering you, sorry.

    Thanks for your help!

  • Cai,

    It's all good! I'm glad a solution was found.

    Thanks for sharing the results!

    Have a great day,

    Manuel Chavez