Hi Laurent,
As you mentioned – it is a slightly complicated case due to the fact, that S12ZVL was not exactly designed for powering from an external source.
When we use external 5V power supply for powering VDDX/VDDA, we should also connect VBAT input pin to this voltage for avoiding transient effects at the internal voltage regulator.
You may use external PNP transistor for powering MCU and the external circuit. I suppose that PNP transistor should not be more expensive than LDO. However, I guess, that you already thought about that option and it is not possible due to some reason.
It is clear, that best solution for measuring ratiometric (proportional) output voltage is when ADC reference voltage equals to supply voltage of the measured voltage source. In that case, we can omit power supply voltage error during ADC measurement.
In that case, I would like to recommend use External circuit power supply as ADC reference voltage (VRL and/or VRH signals). This should eliminate power supply voltage error. However, we should somehow manage that External circuit power supply (VRH signal) will be in range VDDA/2~VDDA. The following constraints exist to obtain full-scale, full range results:
VSSA<=VRL<=VIN<=VRH<=VDDA
The ADC reference Voltage signal VRH_1 is mapped to VDDA; VRH_0 is mapped to PAD0; VRL_1 is mapped to VSSA and VRL_0 is mapped to PAD1.
So, this solution will consume 1 or 2 additional PAD pins.
As you mention, the conversion through absolute voltage area may be too complex and brings an additional source of issues.
When we use VDDA as the reference voltage, the VDDA error may be reduced by additional bandgap voltage measurement:
https://community.nxp.com/docs/DOC-332475
The external circuit power supply error should be compensated similar way by additional external circuit power supply voltage measurement.
So, in this case, we need at least three ADC measurement (cannot be captured exactly at the same time) and at least one additional PAD input for external circuit power supply voltage (probably through voltage divider with their own error).
I hope it helps you.
Have a great day,
Radek
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------