INA228 - I’m reading the current register value, but the result is wrong. Why am I not reading the value that I expect to be reading?
TI Answer;
There can be many reasons why a result is not what you expect it to be. Before trying the debug steps below, it is a good idea to check if your measurement is within expected error limits. Here is a link to an error calculator tool that can help you evaluate your expected system errors:
Error tool: CS-AMPLIFIER-ERROR-TOOL Calculation tool | TI.com
If you find your system is not set up to measure the current you are trying to measure, here is an app note and Excel tool that can help you get started with digital power monitors and picking the correct shunt resistor for your needs:
App note: Getting Started with Digital Power Monitors (Rev. A)
Calculator tool: SBOR021 Calculation tool | TI.com
Here are some steps you can take to debug why the current result is not what you expect, along with some common problems that may be causing the issue.
First, determine if the voltage is being changed before it reaches the INA itself:
To do this, measure the differential voltage as close to the pins of the device as possible, and compare it with what you expected the value to be.
If this voltage is NOT what you expect it to be, that means the voltage is being changed before it reaches the device. Here are some common reasons why this may happen:
- Shunt resistor tolerance:
- The error or deviation in your shunt resistor may be more than you were expecting, and the voltage drop across the resistor may not be what is expected.
- You can confirm this by measuring the voltage drop directly over the shunt and confirm if it is what you expect.
- Layout issues:
- Use Kelvin connections to connect the shunt sense lines to the resistor pads.
- Make sure the sense trace routing is relatively balanced.
- Avoid routing high current paths through the sense trace paths.
- Ensure there is a good path from the ground pin to the system ground.
- Input filter errors:
- Make sure that the input filter resistors are within the datasheet recommended values, and that the resistors are relatively balanced.
- Input surge currents:
- When measuring very small currents, sometimes surge currents on IN+ and IN- can cause more error than expected. To help with this, add a small capacitor (about 1nF to 10nF) across IN+ and IN-. Place this cap physically close to the device.
- Other error sources:
- Here is a link to a video series that discusses various types of possible error sources: Precision labs series: Current sense amplifiers | TI.com
If the value at IN+ and IN- IS what you expect it to be, follow these steps to find the problem:
- First make sure that you are having successful communication with the device. Read some known registers (such as the Device_ID or Manufacturer_ID) to confirm. If you are having communication problems, see one of these E2E FAQs:
- For I2C devices: [FAQ] INA238: Troubleshooting I2C Communication Failures (NACK) in TI Current Sense Power Monitors - Amplifiers forum - Amplifiers - TI E2E support forums
- For SPI devices: [FAQ] INA229: Registers are reading incorrectly - Amplifiers forum - Amplifiers - TI E2E support forums
- Compare the measured shunt value with the result value from the shunt voltage register (not the current register).
- If the value is what you expect, go to step 3.
- If the value is not what you expect, here are some common reasons:
1. Make sure the INA uses the same ground as the load.
2. Check that you are using the correct LSB, which changes based on ADCRANGE.
3. Make sure that conversions are enabled.
4. Check for code errors:- Make sure you are properly handling 2’s compliment. Even if you are not expecting negative values, when measuring close to 0, you may have slightly negative values (due to noise, etc), which could make the value look like a very large positive number instead of a small negative one.
- For help with code, you can utilize SysConfig, which generates C code based on your desired configuration and has convenient functions for parsing register data. Here is a link to the login, you will need to register with TI: Login Link
- If you’ve gotten to this point, and the current reading is still not what you expect, then here are some common problems:
- Calibration Register (SHUNT_CAL):
1. Verify that your math for the calibration register is correct. Note that this value calculation depends on your chosen ADCRANGE as well as your shunt resistor and chosen current LSB value.
2. Make sure that the value you calculated for SHUNT_CAL actually fits in the register size. If not, you may have to change your shunt size, or your max expected current (via and therefore CURRENT_LSB). - Look for error flags in DIAG_ALRT:
1. MATHOF: When seeing a MATHOF, the results will usually not be as expected, for example the results may show 0, or possibly the max register value. A common reason for MATHOF errors is that a current was measured on VSHUNT that is higher than the current used in calculations for the SHUNT_CAL register. If you expect to see that current level again, then recalculate your SHUNT_CAL value based on a new maximum expected current.
2. MEMSTAT: If you see this flag, then there is something wrong with the device and the part should be returned to TI for failure analysis. This process must be done through the source you got the part from, but here are a couple of resources that should help:- Failure Analysis page: Failure analysis | TI.com
- Customer Returns page: Customer returns | TI.com
3. Check for code errors:
2. See item 2.b.D above.
Note: Although these debug steps are for current measurements, you can use a similar process to debug a bus voltage measurement.
More Information can be found here via Original TI Supprot Forum