2 Replies Latest reply on May 18, 2017 9:56 AM by jasonkahana_1482786

    Calibration of Del Sig ADC with AN68403


      I am using a PSOC5LP and want to calibrate the ADC in the final product that I am developing.  I got the code from AN68403 and ran it on my PSOC5LP system with a 16-bit differential DelSig +/- 1.024 V.  It says it successfully wrote the GCOR and OCOR to EEPROM.  But it seems to have no effect on my readings.  When I run a ReadGCOR(), the output is 39654 regardless of whether the calibration was done or not.  I even cleared the EEPROM page 1 and 2 without rewriting the GCOR and OCOR and still get the same result for ReadGCOR().


      I went so far as to mess up the code by setting a false GAIN setting- this messes up the Gn Cor value, but the ReadGCOR() doesn't change.




      Is the code from AN68403 appropriate for the CY8CKit-059 with the CY8C5888LTI-LP097 chip?




      Can someone help me get this figured out?





        • 1. Re: Calibration of Del Sig ADC with AN68403

          I cannot find a place where you call the SetGCOR() API or read any value from eeprom. Instead I see that you issue a software reset which will start erasing the eeprom in your initialization. In eeprom datasheet is a hint regarding the Start() API requiring a short wait until the first access.





          • 2. Re: Calibration of Del Sig ADC with AN68403

            That reset actually doesn't get called unless the button is pushed.   So it shouldn't be a problem.


            So- I need to get the gcor value from EEPROM bytes 0-1 and the ocor value from bytes 2-5, correct?




            int32 ocor_new = EEPROMReadlong(2);  
            int32 ocor_old = (int32) (DelSig_DEC_OCOR_REG) + ((int32)(DelSig_DEC_OCORM_REG) << 8) + ((int32) (DelSig_DEC_OCORH_REG) <<16);
            /* Add the offset correction read from EEPROM to the existing OCOR value */
            int32 ocor = ocor_old + ocor_new;
            /* Write the updated OCOR value back to registers */
            DelSig_DEC_OCOR_REG += EEPROM_ReadByte(4);
            DelSig_DEC_OCORM_REG+= EEPROM_ReadByte(3);
            DelSig_DEC_OCORH_REG+= EEPROM_ReadByte(2);
            /* Update the GCOR register with the GCOR adjustment read from EEPROM */
            uint16 gcor_new = EEPROMReadtwobytes(0);  //(Reads two bytes and combines into a uint16)