3 Replies Latest reply on Jun 28, 2019 9:09 AM by BoTa_264741

    PSoC 5LP - ADC_SAR -  void ADC_SetScaledGain(int16 adcGain)



      I'd like to use the ADC_SAR  and I have some question regarding using this API  :  void ADC_SetScaledGain(int16 adcGain)

      According to the data sheet     adcGain = counts x 10 / Vmeasured.

      This work OK , I have a prototype working based on that..

      Now, assume I want to calibrate the signal chain including gain op amp and active filter and also assume that I cannot use the Delta

      sigma ADC.

      I can supply a known voltage  close to the reference voltage (in my case 1024 mv.)  and measure as directed

      with a voltmeter  the voltage at the ADC input an get the value of adcGain.

      If I wanted to make a PCB serially I would need to do this measurement on each board. ?

      How automate this? Some suggestion ?

      Thanks in advance

        • 1. Re: PSoC 5LP - ADC_SAR -  void ADC_SetScaledGain(int16 adcGain)


          Instead of factory calibration against an external voltage (e.g. 1024mV) and adjusting Gain setting, consider using onboard reference Vref = 1.02V as input test voltage, and record measured value (e.g. Vmeasured = 0.99V). Then all data need to be corrected for coefficient: coeff = Vref/Vmeasured. This procedure can be run every time on startup (with some MUX), so no factory calibration required.


          High-precision absolute voltage measurement can be tricky if better than 10^-3 resolution is needed. Usually, a stable external voltage source is used for calibration (like Mercury-Silver battery) on every measurement, as internal Vref drifts away. If accuracy of few mV is sufficient, then existing PSoC factory calibration of ADC should suffice.


          • 2. Re: PSoC 5LP - ADC_SAR -  void ADC_SetScaledGain(int16 adcGain)



            Thank you.

            You said

            record measured value (e.g. Vmeasured = 0.99V).

            Can you clarify how you get those (in this case )  0.99V ?

            1- Using the same SAR_ADC ?

            2- Reading the counts  you get from 1.02 V ?

            • 3. Re: PSoC 5LP - ADC_SAR -  void ADC_SetScaledGain(int16 adcGain)


              The values Vmeasired = "0.99V" and Vref="1.02V" are purely artificial numbers out of my head. They were provided just to clarify the idea.


              On startup, lets switch mux to a pin, connected to the PSoC reference Vref=1.02V and measure signal using ADC_SAR (lets call it "Vref"). The same Vref should be used as ADC_SAR reference voltage. Ideally, if SAR-ADC is calibrated perfectly, the value returned should be 1.024V, but in reality it can be slightly off (lets say it is Vmeasured = 0.99V). This discrepancy may come from uncalibrated SAR_ADC. Now we know that every measurement returned by the SAR_ADC is off by a coefficient  0.99V/1.024V  = 0.96679. Therefore, to get correct ADC values, all ADC_SAR results must be scaled up by 1.024/0.99 = 1.0343434.


              As alternative procedure, you may adjust ADC_SAR Gain calibration by iterations, until measured result will become 1.024V, but i think that it is slower.