Skip to content

Fix calculations for current sources and current monitoring

Eric Buschmann requested to merge ebuschma/peary:current_fix into master

While testing the current sources on our new boards I noticed that the actual current is always about 1.024 times larger than the set current. Turns out that the calculation used the wrong constant (CAR_VREF_4P0, which is 4.096) instead of the correct value 4. This value comes from a 1/40 voltage divider behind the DAC and a 100 Ohm sense resistor and is completely unrelated to the DAC reference voltage. This also means that the actual range goes up to 1024 uA and the (DAC) step size is 250 nA.

Another issue was in the INA226 current monitoring, which can return negative values that were treated as positive.

Edited by Eric Buschmann

Merge request reports