Calculating voltage from AFE differential value

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Calculating voltage from AFE differential value

1,544 Views
Larbohell
Contributor I

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 VREFHVREFL 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?

0 Kudos
Reply
7 Replies

1,482 Views
Larbohell
Contributor I

I'm still confused about the voltage references. The VREF pin can be used for giving the AFE an external voltage reference, right? So say I input 2.00V on the VREF pin, and set S3=L to use the external voltage reference for the AFE. How do I now calculate the voltage? The value should be different if I use for instance 1.50V and 2.00V on the VREF pin, so surely I can't just use the simple formula V_calc = (val/(2^24)) * 0.5 in all these cases.

Also, what is the allowed voltage range on the VREF pin? I can't find any information on that.

0 Kudos
Reply

1,473 Views
nxf56274
NXP Employee
NXP Employee

Hi,

VREF is used to generate fixed voltage for VREFH(1.2V) and VREFL(0.4V). VREF should be around 1.2V. 

Have a great day,
TIC

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

- We are following threads for 7 days after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos
Reply

1,534 Views
nxf56274
NXP Employee
NXP Employee

Hi,

Hope this link will give you some ideals.

https://community.nxp.com/t5/Kinetis-Microcontrollers/Resolution-AFE-MKM34Z256/m-p/847175

Have a great day,
TIC

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

- We are following threads for 7 days after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos
Reply

1,527 Views
Larbohell
Contributor I

Hi,

Scaling the voltage measurement val using the given +/- 500 mV input range actually produces okay-ish results:

V_calc = (val/0x7FFFFF) * 0.5V

but I don't think that's the correct way to do it. First of all, the 500 mV is only a "typical" value given in the datasheet (6.4.4.1), and may therefore vary enough to make V_calc useless. Secondly, what would then be the point of the reference voltages, VREFH, VREFL and VREF?

0 Kudos
Reply

1,516 Views
nxf56274
NXP Employee
NXP Employee

Hi,

It is a limitation.

1.PNG

This device includes a voltage reference (VREF) to supply an accurate 1.2 V voltage
output. VREFH and VREFL use for output.

2.PNG

Have a great day,
TIC

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

- We are following threads for 7 days after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos
Reply

1,514 Views
Larbohell
Contributor I

Hi,

I know and understand all that. My question is simply: How do I calculate the input voltage from the digital output value?

Say I use the AFE and get a measurement of 4538388 / 0x454014 from channel 0. How do I calculate the actual voltage value?

0 Kudos
Reply

1,495 Views
nxf56274
NXP Employee
NXP Employee

Hi,

V_calc = (val/(2^24)) * 0.5

If the value smaller than 0, the digital value should convert. Because the result is 2's complement.

 

Have a great day,
TIC

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

- We are following threads for 7 days after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos
Reply