Re: Clarification on shunt-resistor value for ina219

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 1/30/24 03:46, Sahaj Sarup wrote:
Hi,

I had a quick question about the ina219 driver

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/hwmon/ti,ina2xx.yaml

Is the devictree expecting the shunt-resistor value that is actually
on the PCB or is it some calculation based on the calibration value
being a static 4096?

I am confused because of this comment in the driver

The comment refers to the relationship between calibration value
and shunt divider. It (tries to) explain how the values in
ina2xx_set_shunt() are calculated. The shunt resistor value provided
in devicetree or with platform data should be accurate.


```
In order to keep calibration register value fixed, the product of
current_lsb and shunt_resistor should also be fixed and equal to
shunt_voltage_lsb = 1 / shunt_div multiplied by 10^9 in order to keep
the scale.
```

I am seeing a bit of deviation with a 13 mOhm shunt at 12v 3A, I am
getting a reading of 3.14 A from the ina219.


Given that there are always system deviations/inaccuracies, that doesn't
sound too bad to me. If you can calibrate against actual measurements,
you could try to improve accuracy by providing a slightly different shunt
resistor value.

Guenter





[Index of Archives]     [LM Sensors]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux