Other Parts Discussed in Thread: INA238
Tool/software:
I'm developing a driver for the INA238 and am getting incorrect current and power values from the device. I think it's related to SHUNT_CAL... I'd appreciate any help with this issue.
On my board, the max expected current is 3A and the Rshunt value is 20 milliOhms.
On initialization and after a reset, these are the register values I am writing to the device. I was able to confirm that the register writes are successful.
- SHUNT_CAL
- Current_LSB = (3 / 2^15) = 91.55 * 1E-6
- SHUNT_CAL = 819.2*1E6 * 91.55 * 1E-6 * 0.020 * 4 = 5,999.821 ~= 6000
- Value is 0x1770 aka 6000
- CONFIG
- Value is 0x10. set bit #4 aka ADCRANGE=1
- Means shunt full range scale is +/- 40.96mV
- ADC_CONFIG
- MODE==0xF
- VBUSCT==0b101
- VSHCT==0b101
- VTCT==0b101
- AVG==0b001
- Value is 0xFB69
I'm using these equations to calculate current and power with the raw register values:
(final current) = CURRENT_LSB * (raw CURRENT reg value)
(final power) = 0.2 * CURRENT_LSB * (bits [15:0] of raw POWER reg value)
These are the results I'm getting:
Manufacturer ID 21577.
Voltage 54387 MilliVolts.
Power 207 MilliWatts.
Current 3 MilliAmps.
Current should be around 300 mA...
Is there anything else I can do to verify the code and hardware?


