cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 4 MCU

Anonymous
Not applicable

Hello.

   

I want to use ADC SAR of PSOC4 for measuring some external variables in the 0-Vdda range.

   

I can use 1.024 ref, and do  resistor dividers for putting all analog voltajes under 1.024V.

   

But if I use Vdda ref, what happens with ADC_CountsTo_Volts function if Vdda changes from 3.6 to 2.8V? 

   

Also, can I measure Vdda directly? 

   

 

   

Best regards.

0 Likes
Reply
21 Replies
Esteemed Contributor

"But if I use Vdda ref, what happens with ADC_CountsTo_Volts function if Vdda changes from 3.6 to 2.8V?"

   

 

   

The function will return counts relative to Vdda, so full scale value would still return the same counts.

   

Stated another way the measurement is only as accurate as its reference.

   

 

   

The best way to accurately measure Vdda, absolute accuracy, is using band gap reference and external precision

   

resistors to divide the Vdda down into Vref range.1% or better R's would do.

   

 

   

Regards, Dana.

0 Likes
Reply
Esteemed Contributor II

Not quite, Dana:

   

The value to calculate is taken from another source, when Vdda is taken as reference, datasheet says:

   

                                    

When the Vref is based on Vdda, the value used for Vdda is set for the project in the System tab of the DWR.

   

   

 

   

This is a fixed value, set at design-time. As far as I remember there was an API in the PSoC3/5 world to set the conversion function yourself, missing in PSoC4?

   

 

   

Bob

0 Likes
Reply
Esteemed Contributor

The conversion function is not aware of absolute Vref. It has a G

   

that is based on a nominal Vdd. That being said no matter what

   

Vdd is, when Vinatod = Vdd (Vref = Vdda) the counts still the same,

   

full scale for this.

   

 

   

So if Vdda = 2.8, Vin = 2.8 volts, counts are the same as if Vdda = 3.2V,

   

Vin = 3.2V, both situations return the same counts, the same results

   

from the API.

   

 

   

Regards, Dana.

0 Likes
Reply
Honored Contributor II

Yes, the full-scale count you get from the ADC is the same in both cases. But if you set the proper Vdda value in the DWR, then ADC_CountsTo_Volts() should return the proper value.

0 Likes
Reply
Anonymous
Not applicable

 Ok, fine. So I must use 1.024 V ref for proper conversion.

   

I'm thinking that using Vdda as ref isn't very useful, even with a LDO supply, there is Vdda variation. Only in cases that the signal is relative to Vdda (potentiometer).

   

Sensing realtime Vdda could be a good improvement for using analog inputs directly in Vss-Vdda range.

   

Thanks a lot to all for the fast response.

0 Likes
Reply
Honored Contributor II

Vdda is usual a good reference when your input also varies with Vdda. Think e.g. a resistor divider (maybe a NTC), hose readings vary with Vdda. In that case its perfectly fine.

0 Likes
Reply
Esteemed Contributor

If your Vdda is from a regulated source, say 5%, and ref is set to Vdda, then

   

5% is your reference accuracy, generally good enough to measure battery voltage

   

and light an LED when it is too low.

   

 

   

Otherwise use the onboard reference looks like -

   

 

   

   

 

   

Regards, Dana.

0 Likes
Reply
Esteemed Contributor II

Cannot see your attached picture, Dana. Only for me or for others the same?

   

 

   

Bob

0 Likes
Reply
Honored Contributor II

I can see the image well. Did you get the allmighty small box maybe?

0 Likes
Reply
Honored Contributor II

If you need to use Vdda as reference, and want to know its value, there is an easy way to measure it: use Vdda as reference, and then measure a know voltage (e.g. the internal reference). From this know value its then easy to calculate Vdda. That way you don't need a resistor divider.

0 Likes
Reply
Esteemed Contributor II

... and where can I find a VRef to measure in a PSoC4? Am I missing something or the PSoC4?

   

 

   

Bob

0 Likes
Reply
Esteemed Contributor

Looks like its not available as a general purpose module, just as a selection

   

in the SAR.

   

 

   

Regards, Dana.

0 Likes
Reply
Esteemed Contributor

Bob, picture was a snapshot of table pasted directly into thread, maybe your security

   

settings an issue ?

   

 

   

Regards, Dana.

0 Likes
Reply
Honored Contributor II

Its strange that the VRef component is not available on the PSoC4. It clearly has an internal voltage reference, so it should be possible to route it to an ADC input... It seems not even possible to measure it (it can be used only as reference).

0 Likes
Reply
Esteemed Contributor

I concur, its also not availabe for OpAmp biasing, comparator, maybe future release will

   

give us the routing. Or we simply see what low costs parts have to sacrifice to hit cost

   

targets, but still satisfy a large class of designs.

   

 

   

Regards, Dana.

0 Likes
Reply
Esteemed Contributor II

It COULD be done:

   

Workaround: Using internal VRef 1.024V with (recommnded) bypass capacitor and external conection to a second analog input pin connected to one channel of the SAR.

   

Since this connection without using the pin could be implemented into an AMux a VRef signal could be provided for the fitter.

   

Looks like a job for one of the Cypress Gurus, who of us is best in triggering the right one?

   

 

   

Bob

0 Likes
Reply
Esteemed Contributor

Bob hit the nail on the head with his recomendation -

   

 

   

0 Likes
Reply
Honored Contributor II

But it seems one can access the reference only when it is used for the SAR ADC, which would defeat my idea from above. I cannot find anouther way to activate the internal reference...

   

The TRM talks abouth the many uses of the reference voltage, but it seems to be hard-wired internally...

0 Likes
Reply
Esteemed Contributor

Or using register writes set the SAR mux up and start up buffer ?

   

 

   

www.cypress.com/     Register TRM

   

 

   

Regards, Dana.

0 Likes
Reply
Esteemed Contributor II

Yes, Dana, that is what I thought of. But I'm sure that this should be molded into a usermodule and officially be supported by Cypress and hopefully soon because this helps to acquire the precision of the ADC throughout the VDDA-range.

   

 

   

Bob

0 Likes
Reply
Esteemed Contributor

Unless there is routing we are not aware of certainly seems, as hli points out,

   

inexplicity tied to SAR, that is if you want SAR to use a reference other than 1.024 V

   

you are hosed to use reference for other uses.

   

 

   

Regards, Dana.

0 Likes
Reply