6 Replies Latest reply on Oct 11, 2020 10:10 PM by BragadeeshV_41

    CSX tuning and CapSense BIST




      I want to analyze and tune a CSX touchpad widget for a project. I am using the CE228931PSoC 4 CapSense CSX Tuning example.


      I turned on the capsense BIST as they mention in the example's PDF, so I can use the BIST specific API like CapSense_GetSensorCapacitance();. However, it is unclear in the capsense 7.0 datasheet (the version I am using with PSOC4100S) what are the 3 arguments to use this method. I think the 1st argument is right in my code below, but I am not sure about the rest. The main problem is that I call it for all of the sensors (15, 3rx and 5tx) in my touchpad widget, which seems like I am doing something wrong. Also, I get wierd results in my UART terminal.. not sure if that means I am using the API wrong or if my hardware is bad! (some of the elements have 0 parasitic capacitance and others have enormous amounts, make no sense).


      I am calling all of this when capsense is not busy*



      How am I supposed to use this API? thanks!

        • 1. Re: CSX tuning and CapSense BIST

          I still have not found the proper usage of this API if anyone knows how?

          • 2. Re: CSX tuning and CapSense BIST



            The API has 3 arguments, the widget ID, Sensor ID and the measurement status pointer that stores the status of measurement.  It returns the capacitance of the sensor element in femtofarads (fF). You can also read back the measurement status to know if the measurement was successful. If successful, it reads "CapSense_TST_MEASUREMENT_SUCCESS" and the measured values are valid.


            The parameters that you've used seem to be correct, you can verify the measurement status value.

            You can have a look at this CE for an example to use this API: https://www.cypress.com/documentation/code-examples/ce229521-psoc-4-capsense-csd-slider-tuning




            • 3. Re: CSX tuning and CapSense BIST

              SahanaH_66 Thank you for your reply!!


              I looked at the CE you shared and it seems like I am doing the right thing.


              It looks however that I am busting the capacitance value for a uint32 for some of my elements.


              1. I get a return value of 2^30, or 1,073,741,824... Is it the firmware (the status always returns 0, which means no error) or I really have over a microfarad in Cp? what happens if this is the case, can I determine the exact Cp or there is nothing I can do since I am busting the uint32 return max value.


              I am skeptical, however, because I based my design on the 41xx devkit touchpad. I must admit however that I am currently testing with a board that has no embedded PSoC, and jumperwires are connected to the 41xx devkit. It works well, but maybe wires generate an aweful lot of Cp.


              2. It is also wierd that I do not get the same values from the return of getsensorcapacitance than with the PTR2SNS_CP_VALUE index. why is the index returning 0, or sometimes other values, when the return is actually returning 2^30 ??


              I am attaching my project just in case.

              • 4. Re: CSX tuning and CapSense BIST

                Hi JeSi_4326976,


                Thanks for the project. The CapSense_GetSensorCapacitance() returns the self capacitance of the sensor, Cp and not mutual capacitance. Therefore the number of sensors here is no of rx elements + no of tx elements. Therefore in your case it is 3 + 5 = 8 elements. Therefore in the for loop in which you are calling CapSense_GetSensorCapacitance(), the loop termination condition should be < 8 and not < 15.



                Therefore only Sensor IDs 0 to 7 are valid, anything greater than that is simply returning junk value.

                    for (int i =0; i < 8 ; i ++)
                                    char msg[30];
                                    sprintf(msg, "Cp elem %d:  Func return: %lu", i, CapSense_GetSensorCapacitance(CapSense_TOUCHPAD0_WDGT_ID, i, &state));
                                    sprintf(msg, "  PTR2SNS_CP_VALUE: %lu\r\n", CapSense_TOUCHPAD0_PTR2SNS_CP_VALUE[i]);
                                    sprintf(msg, "status: %lur\r\n", status);


                How the sensor ID parameters are assigned to the Tx and Rx segments is given in the explanation of the API  CapSense_GetSensorCapacitance() in the component datasheet.


                The Cp of the Rx elements seems to be  abnormal or less. Can you please check if any of the BIST tests are failing on these sensors?




                1 of 1 people found this helpful
                • 5. Re: CSX tuning and CapSense BIST

                  Hi BragadeeshV_41


                  I tried running all of the BIST tests as you asked but I cannot get any failed test, even when I unplug the wires to the RX sensors to get a short. Maybe I am not correctly using the bitmask? This is how I am using it:

                  I always get SUCCEEDED! printed on the terminal...


                  Here is my program just in case.

                  • 6. Re: CSX tuning and CapSense BIST

                    Hi JeSi_4326976,


                    Can you measure the capacitance of the Rx electrodes using LCR meter to confirm this?