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?
"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.
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?
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.
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.
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.
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.
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 -
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.
Bob, picture was a snapshot of table pasted directly into thread, maybe your security
settings an issue ?
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).
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.
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?
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...
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.
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.