Greetings,
I am a user of your INA219 sensor, and I occasionally encounter an issue labeled as 'mathoverflow' during my data readings. Here is a breakdown of my configuration:
CONFIGURATION_REG = 0x0773 // FSR = 16V; Gain = 1; Range = 40mV; BADC = SADC = 64 (oversampling); Mode = shunt and bus triggered
R_SHUNT = 0.004 Ohm
CURRENT_LSB = 0.00030517578125 // Range[V] / R_SHUNT[Ohm] / 2^15
CALIB_VALUE = 0x8312 // (uint16_t)(0.04096 / (Range[V] /2^15))
Additionally, should I shift the calibration value left by one bit when writing it?
Furthermore, I've observed that each time I modify the gain value in the configuration register, the output appears to be multiplied by 2. I've calculated the current LSB and the CALIB_VALUE using the equations provided in the comments above. Any insights into this behavior would be appreciated.
I seek your guidance on resolving this issues, which arises intermittently during my data acquisition. Any insights or assistance you can provide would be greatly appreciated.
Best regards, Genadi.