I'm having a very basic problem with the AFE module (Sigma-delta ADC) on the TWR-KM34Z50M devkit (KM34 MCU). I simply cannot find the right way to calculate voltage from the measured ADC value.
What I'm doing is to input some differential voltage between the SD_ADP0 and SD_ADM0 input pins, say 500 mV, supplied from a basic power supply. I then take a bunch of ADC readings and use this forumla:
V_calc = (val/0x7FFFFF) * V_ref
One part of my problem is determining what V_ref should be. I find the datasheet and reference manual very confusing in explaining this aspect, as there are internally generated VREFH (1.2V) and VREFL (0.4V) signals, as well as two pins called VREFH and VREFL which seem to always be connected to these two signals. Then there is also a VREF pin, which can optionally be used as an external reference input instead of the internal VREFH.
Now, I've tried to use VREFH, VREFL and (VREFH-VREFL) as the V_ref in my calculation above, and I've tried supplying an external reference on the VREF pin as well. I've used the S0, S1 and S2 switches to set the reference going to the AFE. No combinations of this lead to me calculating the correct voltage.
What am I doing wrong here?