8 Replies Latest reply on Sep 9, 2019 8:51 AM by anma_3197476

    Real capacitor measurement on CY8CKIT-145

    anma_3197476

      Dear All,

       

      • I make a simple test by connecting a 23.4 pF capacitor on p1.4 , then configuring CapSense as follows:
        • Modulator clock= 12 000 kHz
        • Sense clock source= Direct
        • IDAC sensing configuration = IDAC sourcing
        • IDAC auto-calibration= disabled
        • IDAC auto-compensation= disabled
        • Sense clock frequency= 750 kHz
        • Resolution= 15 bits
        • IDAC modulator= 18

       

           Then compile and launch tuner. I had to adjust IDAC modulator from 18 to 20 in order to get Raw counts as close as possible from  27852 (which is 85% of 32767)
           So, the nearest value of raw counts I got was 27376. So, we have here 27376 counts for a 23.4 pF capacitor

           Up to now, everything looks fine.

       

      • Now, I would like to double check with the formula below:
        I made a LibreOffice calculation sheet (you can open it with Excel) with the above parameters and got a 32862 raw counts value !

       

                So, we have two cases:

       

               Either I should have read around 32862 raw counts in tuner OR something is wrong in my calculation sheet

      Any support will be appreciated
      Anma

        • 1. Re: Real capacitor measurement on CY8CKIT-145
          AH_96

          Hello anma_3197476

           

          Can you please use the built in self test (BIST) library to check what the parasitic capacitance (Cp) as observed by the GPIO pin is? It returns the value in pF and this can confirm if the Capacitance observed is 23.4pF.

          Please make sure that IDAC auto calibration is disabled as the equation for raw counts has an extra term when compensation IDAC is present.

          Please share the CapSense configuration file (Configure CapSense -> Save configuration).

           

          Best regards

          Hari

          • 2. Re: Real capacitor measurement on CY8CKIT-145
            anma_3197476

            Hi Hari,

            I have activated BIST, put in main.c a few code using GetSensorCapacitance API but I cannot read any Capacitance value on tuner.
            Only Raw counts are displayed as usual. Any idea ?

                main.c.PNG

            Here is the Capsense configuration files as requested.

            Thanks for your help !

            Anma

            • 3. Re: Real capacitor measurement on CY8CKIT-145
              AH_96

              Hello anma_3197476

               

              Sensor capacitance will not be displayed in tuner. You can add a break point and observe the value by debugging the program or use a communication protocol (such as UART) to observe the value in a terminal application (such as Tera Term).

               

              Thanks and regards

              Hari

              1 of 1 people found this helpful
              • 4. Re: Real capacitor measurement on CY8CKIT-145
                anma_3197476

                Thanks AH_96 for this clear and fast answer.
                Regarding the location of the GetSensorCapacitance(.....)  I put it before the do....while loop. Should I put it inside ?

                Thx
                Anma

                • 5. Re: Real capacitor measurement on CY8CKIT-145
                  AH_96

                  Hi anma_3197476

                   

                  You can add the GetSensorCapacitance before the do-while loop. This function can be called after CapSense_Start() is executed.

                   

                  Best regards

                  Hari

                  1 of 1 people found this helpful
                  • 6. Re: Real capacitor measurement on CY8CKIT-145
                    anma_3197476

                    Hi,

                    I got 0x0000001A as capacitance value, which is 26 pf

                     

                        debut.PNG

                    So 26 pF is far from 23.4 pF and once entered in the formula, it gives a 36514 Raw counts, which is closer to 32862 but still unexplained !

                    Remark:
                    I very surprised by the "low resolution" of capacitance conversion routine. No floating value. Just something between 5 and 255 pF !

                     

                    So, any explanation will be welcome...

                     

                    Anma

                    • 7. Re: Real capacitor measurement on CY8CKIT-145
                      AH_96

                      Hi anma_3197476

                       

                      The Cp that is obtained by BIST is the capacitance observed from the pin and includes the pin capacitance, trace capacitance and final sensor capacitance. Hence, this slight variation is expected.

                       

                      The problem is with the selection of Vref. The external power that you are supplying is 5V, and therefore, the selection of Vref should have been 2.7429V. However, in the system tab of Design wide resources, there is an option to set VDDD and VDDA

                       

                      Please make sure that these are set to 5V. In the current case, it is set to 3V and therefore, Vref is set to 2V and hence the difference in calculation.

                       

                      Thanks and regards

                      Hari

                      • 8. Re: Real capacitor measurement on CY8CKIT-145
                        anma_3197476

                        Hi Hari,

                         

                        Now changed VDDA and VDDD to 5V

                             Vref.PNG

                        Still having the 23.4 pF capacitor on p1.4 , with CapSense configured as follows:

                        • Modulator clock= 12 000 kHz
                        • Sense clock source= Direct
                        • IDAC sensing configuration = IDAC sourcing
                        • IDAC auto-calibration= disabled
                        • IDAC auto-compensation= disabled
                        • Sense clock frequency= 750 kHz
                        • Resolution= 15 bits
                        • IDAC modulator= 27 (adjusted to get as close as possible to 27852 ,which is 85% of 32767)

                         

                        Then Raw counts gives 27567

                        tuner.PNG

                        Read capacitor using API in debug mode is 26 pF

                        Then formula with 26 pF and IDAC mode= 27 gives 27047 counts.

                        I think these values are pretty close and we have now a good correlation between formula and reality, isn't it ?

                        Thanks for your help
                        Anma