I have an ultra low power design running on CR2032 where it is critical to monitor precisely the current usage and the primary cell voltage during dev.
So I added a second MCU dedicated to instrumentation, it is powered by its own rechargeable battery and shares GND with the DUT, it also gets the current range from the auto scaling circuit.
Current sensing is done via an auto scaling circuit made of op amps and P MOS (9mR) switching automatically a shunt ladder ranging from 1K to 1R according to the power usage. The operation is standalone and the MCU gets the current range on a GPIO for each range.
Scaling from mV is done by an high side instrumentation amplifier MAX9938.
Conversion is done by the MCU ADC.
This provides a very good precision and is perfect for the current, effectively ranging from nA to uA and mA (can reach A if needed).
The problem is for voltage sensing. The discharge curve of CR2032 is very flat until it drops abruptly at the end of life, thus a sub-millivolt accuracy is a must. Also the useful voltage range is limited, 2.8V to 3.2V at the very most. So with ADC accuracy (12bit) it would make sense to scale 2.7-3.2 to 0-3.3V, for 400/4096=0.09mV steps precision (in a noise free ideal world).
I can do it with opamp in simulation, but it takes a 2.5V voltage ref, a bunch of resistors, a -1V and a +4V rail, all that feels bad and I am pretty sure it will only works in the simulation, I expect it to be off in real world.
So I wonder if anyone has an idea, or knows some trick, to basically scale 2.7 to 3.2V range into 0 to 3.3V, cleanly, with few parts and not too much funny stuffs (I admit that a voltage reference of 3.2V may be necessary).
All that, provided that the DUT and the instrumentation share a GND, so there is no possibility for virtual ground or at least the 0 to 3.3V final signal has to be referenced to GND and scale down to 0V (or close). I wish it could be done with rail to rail single supply opamp. I already have two "special" rails: -8V, -7 (after an LDO) and -2V. I also have 4.0V from the MCU LiP0, and 3.3V from another LDO.
Also, due to the scenario it is mandatory that the impedance to the battery is very high, I can always use the same MAX9938 (25x to 200x) to sense millivolt on high side, but the problem is to introduce this offset so that 2.8V at the battery sense gives 0V at the output.