K10 ADC CHIP Board voltage?

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

K10 ADC CHIP Board voltage?

Jump to solution
805 Views
mrandreas
Contributor III

I'm a SW developer with close to null experience with low level development and HW. So that’s the explanation for any idiotic reasoning and Please keep “newbie factor” in mind when answering.

We have a requirement to read board voltage. So is it possible to configure the internal ADC to read the 3.3 board voltage no diff pin out to sense circuit attached?

best regards

Andreas

Labels (1)
Tags (1)
0 Kudos
1 Solution
568 Views
Paul_Tian
NXP Employee
NXP Employee

Hi, Andreas

Of course. You can use MCU internal ADC to detect value of 3.3V board voltage. It is no need to use differential pin, you can use single pin directly.


Hope my reply can help you.


Best Regards

Paul

View solution in original post

0 Kudos
4 Replies
570 Views
mrandreas
Contributor III

Hi, tanks for the answer.

Can you support me with an code example?

best regards

Andreas

0 Kudos
570 Views
egoodii
Senior Contributor III

On the whole, the Freescale demo/example projects are a 'pretty good' source to follow to get peripheral modules up and running.  Attached is my code to read a few analog pins plus the PMC 1V bandgap (I was thinking of the wrong BandGap previously, AD27 comes from the PMC 1V+/-3% point), using Vdd=VddA=VrefH=3.3V(nominal).  My actual conversion result (stored as an integer multiplied by 100000) nets a 1V reading of 0.985V, so the 'inverse millivolt math' of 3300*1000/985 (the ideal ratio in millivolts) gives me an actual VDD of 3350mV, whereas it actually measures 3330mV.

I call ADC_HW_Init() early-on, and some time later ADC_ReadAll() to preset the ongoing measurement array.  You'll probably only have the ONE measurement to make...  My table of channel-info ADC_CHAN_DEFN has several power-supply dividers feeding some other analog inputs.

So then on every timer-tick I convert one of my channels with ADC_Read_Filt_One(chan) which updates a 1-part-in-100 recursive filter to make a pretty long-term average (and leads to the overall 100*1000 voltage scaling).

Let me know if this code set 'comes up seriously short' of something (other than our local integer typedefs).

0 Kudos
569 Views
Paul_Tian
NXP Employee
NXP Employee

Hi, Andreas

Of course. You can use MCU internal ADC to detect value of 3.3V board voltage. It is no need to use differential pin, you can use single pin directly.


Hope my reply can help you.


Best Regards

Paul

0 Kudos
570 Views
egoodii
Senior Contributor III

I'm not quite sure what your statement 'board voltage no diff pin out to sense circuit attached' means, but I think we can assume it means there are no specific external circuits set up to measure your supply voltages.

So as a 'general statement' I can say that you can 'measure' the voltage of VrefH by selecting and converting the internal bandgap reference voltage (AD27).  The ratio of the conversion result to the 'nominal' 1.195V thereof, in a bit of 'inverse math', gives you the voltage on VrefH:  VrefH_mV = (1195/*mV*/ * ADC_FULLSCALE) / ConversionResult.

Now, that being said, I will point out that the internal 1.195V is not very stable across temperature, so you can't expect accuracy better than about +/-3%.

0 Kudos