7 Replies Latest reply on Jun 8, 2017 11:18 AM by user_1377889

    AN68403 - Two point calibration

    user_301665782

      Hi all

         

      I am trying to test the AN68403 and verify which is the calibration outcome for this method.

         

      I modified the original code as you will see on a attached project.

         

      I replaced the VDAC for an ADR130, a 500 mv extern voltage reference and I used the potentiometer included on a KIT-050 to feed the input of the PGA_1  after the Software calibration is done.

         

      The calibration was done using APIs to set  ADC_DelSig_1_Offset  and  ADC_DelSig_1_CountsPerVolt;

         

      I'm not sure if this test result is correct  with the two point calibration method using  Soft APIs.

         

      I would like  some commentary on the fact that once the Offset and Gain has been corrected  the potentiometer voltage range between measurement  from #2 & to #5  there is so much error.

         

      I am attached  a table with the Potentiometer voltages applied to the PGA_1 versus the readouts on the digital display.

         

      The volts measurement was done with a Fluke 87V  range 6.000 V,   accuracy  ± (0.05 % + 1) .

         

      I know that there are others error to account for like DNL, INL, etc.  but at this point regarding DC behavior I would need some explanation on a low voltage range.

         

      Is there something wrong with the code?

         

      Thank you very much for any help.

        • 1. Re: AN68403 - Two point calibration
          user_301665782

          Hi there

             

          Can I expect some answer to my last post?

             

          Thank you in advance

          • 2. Re: AN68403 - Two point calibration
            user_1377889

            It is recommended to bypass the reference voltage with a 1µF cap at pin P0_3 or P3_2.

               

            Set in ADC configuration Reference, but check if on your board the cap is already installed. See if that works better.

               

             

               

            Bob

            • 3. Re: AN68403 - Two point calibration
              user_301665782

              Hi Bob, yes,  I  put a 1.0 uf capacitor not in a project I posted here but on other I tested after and the table with Vin and ADC counts remain the same.

                 

              I  just have a little experience with analog circuits,  may be you can consider that and be so kind to give some help to understand why after calibration at zero volt and almost ADC FS range I get such error. My understanding is it is not about DNL or INL because the errors are very big  as you can see. So every thing is OK at end of two point calibration but not in the middle.

                 

              Thank you very much for your answer.

              • 4. Re: AN68403 - Two point calibration
                user_301665782

                Hi Bob

                   

                I saw a similar post but it doesn't work for mi case.

                   

                This time I am trying to use  the hardware method  for offset and gain adjustment.

                   

                Please find attached Topdesign.

                   

                I am facing some issues regarding the use of GCOR and OCOR for the Delta Sigma Converter.

                   

                I followed the explanation of AN 68403,  I set  the values of those registers up in a calibration function, afterward  I am  doing measurements with the ADC but the ADC counts I am  getting are Zero values.

                   

                The main loop is only a measurement function an also the calibration function which is always called but it is only for test purpose.

                   

                The same measurement function give non calibrated counts, but  it give me counts when I am not using the calibration function

                   

                The following code snippet is the procedure I am following to set the  correction registers up.

                   

                In that function is a fact that :

                   

                1-The Registers GCOR and OCOR are written in EEPROM  verified through the debugger using a memory windows.

                   

                2-That the return value of " ADC_DelSig_1_SetGCOR(gcor_newf); " is zero telling me that the correction multiplier is in the range 0 to 1.999.

                   

                3-   The conversion of gcor_new to float is OK and verified with a on line converter -  " gcor_newf = GetFloatP(gcor_new); "

                   

                4- The ADC is bypassed at P0(3) .

                   

                   

                   

                /* Read the existing OCOR register to ocor_old */

                   

                    ocor_old = (int32) (ADC_DelSig_1_DEC_OCOR_REG) +         // 0X40004E08

                   

                ((int32) (ADC_DelSig_1_DEC_OCORM_REG) << 8) +               //0X40004E09

                   

                ((int32) (ADC_DelSig_1_DEC_OCORH_REG) <<16);                 //0X40004E0A

                   

                 

                   

                //Read from EEPROM the ocor_new

                   

                                    

                   

                       ocor_new=0;

                   

                 

                   

                       ocor_newL = CY_GET_REG8(CYDEV_EE_BASE + 4);

                   

                       ocor_newM = CY_GET_REG8(CYDEV_EE_BASE + 5);

                   

                       ocor_newH = CY_GET_REG8(CYDEV_EE_BASE + 6);

                   

                      

                   

                       ocor_new= ocor_newL | ocor_newM<<8 |ocor_newH<<16;

                   

                   

                   

                /* Add the offset correction read from EEPROM to the existing OCOR value */

                   

                ocor = ocor_old + ocor_new;

                   

                 

                   

                /* Write the updated OCOR value back to registers */

                   

                ADC_DelSig_1_DEC_OCOR_REG  = (int8)(ocor);

                   

                ADC_DelSig_1_DEC_OCORM_REG = (int8)(ocor>>8);

                   

                ADC_DelSig_1_DEC_OCORH_REG = (int8)(ocor>>16);

                   

                 

                   

                /* Update the GCOR register with the GCOR adjustment read from EEPROM */

                   

                 

                   

                /*Read from EEPROM the gcor_new*/

                   

                 gcor_newl= CY_GET_REG8(CYDEV_EE_BASE );

                   

                 gcor_newh= CY_GET_REG8(CYDEV_EE_BASE + 1);

                   

                 gcor_new= gcor_newl | gcor_newh<<8;

                   

                 

                   

                /* Convert gcor_new to float*/

                   

                 

                   

                 gcor_newf = GetFloatP(gcor_new);

                   

                 

                   

                 ExistentGcor =ADC_DelSig_1_ReadGCOR() ;

                   

                 

                   

                 Retval= ADC_DelSig_1_SetGCOR(gcor_newf);

                   

                ADC_DelSig_1_DEC_CR_REG|=0x10;

                   

                 

                   

                 

                   

                Hope you can help me with this.

                   

                Thank you in advance.

                • 5. Re: AN68403 - Two point calibration
                  user_1377889

                  I do not understand why you are going the complicated way by writing directly io internal registers.

                     

                  When you have got two different known voltages measured you can compare them to the result and solve the equation for

                     

                  y = a*x +b

                     

                  Then you can use the functions ADC_SetOffset(b) and ADC_SetGain(a) to do a 2-point calibration.

                     

                   

                     

                  Bob

                  • 6. Re: AN68403 - Two point calibration
                    user_301665782

                    Thank you Bob

                       

                    I am wondering why this complicated way is suggested in the AN 68403.

                       

                    Also is suggested to use the APIs to do soft calibration.

                       

                    As a commentary before that, I used the linear equation you are suggesting me to get "a" and "b", afterward  I applied:   ADC corrected =(Adc read - b) /a .

                       

                    The Vdacs were set to 10 mv and 1124 mv to get "a" and "b".

                       

                    As a result the gain of the signal chain is approx 7 instead of approx 8, (PGA gain=8) and LPF gain<1.

                       

                    On the other hand I am sure you will give me an explanation about when to use the method of the AN 68403 for PSoC LP.

                       

                    Thank you very much for your help, as always you do.

                       

                    Alex

                    • 7. Re: AN68403 - Two point calibration
                      user_1377889

                      The appnote AN 68403 is comparably old, it goes back to Creator 2.0 as you can see. I presume that at that time the components weren't as comfortable as nowadays. When you need more precision you could write your own conversion using float arithmetic.

                         

                       

                         

                      Bob