13 Replies Latest reply on Jan 22, 2020 9:53 PM by BragadeeshV_41

    How to write firmware for a CSX button matrix on PSoC 6 Capsense? (Are there code examples online too)

    JeSi_4326976

      Hi, I didn't find what I am looking for on the capsense v3 datasheet for PSoC 6.

      I know how to operate individual buttons with the self and mutual configs (PSOC 6 101 helped a lot) but I need to setup a matrix with the CSX mutual config.

       

      I am looking for a firmware example so I could try to implement it by myself. I don't know at all how similar it is to implementing a single button widget.

       

      I am also unsure of one thing on the hardware side: as I setup the number of TX and RX pins in my capsense instance, does it refer to the amount of rows and columns, in which case a 4x4 matrix would have 16 buttons with 8 pins. I have no Idea how to read each RX row (or column) individually with the firmware I must write (maybe it's done automatically with the APIs).

       

      Basically, I just need to know how to write code for a CSX button matrix. Thanks!

        • 1. Re: How to write firmware for a CSX button matrix on PSoC 6 Capsense? (Are there code examples online too)
          BragadeeshV_41

          Hi JeSi_4326976,

           

          When you configure a matrix widget of 4 x 4, it means you will need 4 TX pins and 4 Rx pins + Cinta and Cintb capacitors. This will form 16 intersection points, thus you will obtain 16 buttons using this configuration.

           

          Currently we do not have a code example to showcase CSX based matrix buttons in PSoC 6.

           

          The firmware takes care of the scanning procedure for the matrix buttons. You need to see the sensor status using the API CapSense_IsMatrixButtonsActive, This API should be used to check if any of the buttons in the matrix widget is active and check which buttons are active in the widget.

           

          The API returns a 32 bit integer. If the returnval is 0 , it means no touch is detected. If a valid touch is detected (DiffCount> FingerTh + Hysteresis), then the corresponding bit will be set in the return value for each of the intersection in the matrix button.

           

          For example, if you have a 4 x 4 matrix, the return status for each of the buttons will be as follows:

           

          Button_Rx0_Tx0 - > 1

          Button_Rx1_Tx0 - > 2

          Button_Rx2_Tx0 - > 4

          Button_Rx3_Tx0 - > 8

          Button_Rx0_Tx1 - > 16

           

          and so on.. If multiple buttons are active, then the corresponding bits will be set as 1.

           

          Hope this helps.

           

          Regards,

          Bragadeesh

          2 of 2 people found this helpful
          • 2. Re: How to write firmware for a CSX button matrix on PSoC 6 Capsense? (Are there code examples online too)
            JeSi_4326976

            BragadeeshV_41 Thanks so much!


            I believe I am on the right track but something does not work quite yet. When I press any button, it thinks I actually press on Button_Rx0_Tx0. I will explain further after explaining the code.

             

            Can you confirm the firmware seems functional? The problem might be due to my electrodes, I've built a messy proof of concept out of aluminum foil before trying to create a pcb prototype.

             

            Here is my code for a 2x2 CSX matrix (sorry I didn't find an insert code button). Briefly, each button should toggle a different color from the LGB LED, and the forth should turn them off. Yet as I press any of those buttons, they all turn the blue LED on (basically when CapSense_IsWidgetActive() returns 1).

             

            #include "project.h"
            #include <stdio.h>

             

            uint8 btn_flag = 0;     //marks which button was pressed last to prevent spamming UART port

             

            void setFlag(uint8 flagID)
            {
                if (btn_flag != flagID)
                            {
                            printf("%d\r\n", flagID);
                            btn_flag = flagID;
                            } 
            }


            int main(void)
            {
                __enable_irq(); /* Enable global interrupts. */ 
                CapSense_Start();
                UART_1_Start();

               
                printf("CSX Matrix Test Initiated..\r\n");
               
                for(;;)
                {
                    if (!CapSense_IsBusy()) //if not busy, ask what state it's in
                    {
                        CapSense_ProcessAllWidgets();   //Performs full data processing of all enabled widgets
                       
                        uint32 pos;
                        pos = CapSense_IsWidgetActive(CapSense_MATRIXBUTTONS0_WDGT_ID);
                        switch (pos)
                        {
                            case 0:
                            setFlag(0);
                            break;
                           
                            case 1:
                            Cy_GPIO_Write(blueLed_PORT, blueLed_NUM, 0);
                            setFlag(1);
                            break;
                           
                            case 2:
                            Cy_GPIO_Write(greenLed_PORT, greenLed_NUM, 0);
                            setFlag(2);
                            break;
                           
                            case 4:
                            Cy_GPIO_Write(redLed_PORT, redLed_NUM, 0);
                            setFlag(3);
                            break;
                           
                            case 8:
                            Cy_GPIO_Write(blueLed_PORT, blueLed_NUM, 1);
                            Cy_GPIO_Write(greenLed_PORT, greenLed_NUM, 1);
                            Cy_GPIO_Write(redLed_PORT, redLed_NUM, 1);
                            setFlag(4);
                            break;
                        }
                    CapSense_UpdateAllBaselines();
                    CapSense_ScanAllWidgets();
                    CyDelay(500);
                    }
                   
                   
                   

                }
            }

            /* [] END OF FILE */

             

            ----------------------------------------------------------------------------------------------------------------

             

            Here is my cheap matrix:

            300px-Bangalore_Wikipedian_on_phone_5_closeup.jpg

            Now each of those 4 lines represent how rows and colums electrodes are connected together. TX and RX are not connected together of course.

             

            If my code is Ok, I will try to figure out what is wrong with my "hardware" and post the solution on this thread. Thanks!

            1 of 1 people found this helpful
            • 3. Re: How to write firmware for a CSX button matrix on PSoC 6 Capsense? (Are there code examples online too)
              BragadeeshV_41

              Hi JeSi_4326976,

               

              The pattern that you have used is a typical track pad and not a matrix button. Cypress matrix button would look something like the below image. Or you can use fish bone pattern for the CapSense buttons as well. Refer to the CapSense design guide for information on the patterns.

              Image result for cypress matrix button

               

              Please let us know your application. Do you require a trackpad or a matrix button. Matrix buttons configuration is generally used when you need to have more no of buttons with lesser pins,.

               

              also, CapSense_IsWidgetActive will say only if the widget is ON or OFF. It will not give information on which button in the matrix is ON. That is why as per your above logic you always end up turning the blue LED ON. So if any of the buttons in the matrix is high, it will return 1. So only Case 1 will execute.

               

              Please use CapSense_IsMatrixButtonsActive. Please check the datasheet for more information on this API.

               

              When multiple buttons are touched your present logic will fail.  So what you need to actually check is if the bit is set or not.

               

                          uint32 pos;

                          pos = CapSense_IsMatrixButtonsActive(CapSense_MATRIXBUTTONS0_WDGT_ID);

               

                          if((pos & 0x0001)!= 0u)

                             {

                               Cy_GPIO_Write(blueLed_PORT, blueLed_NUM, 0);

                              setFlag(1);

                             }

                         if((pos & 0x0002)!= 0u)

                             {

                              Cy_GPIO_Write(greenLed_PORT, greenLed_NUM, 0);

                              setFlag(2);

                             }

                         if((pos & 0x0004)!= 0u)

                             {

                              Cy_GPIO_Write(redLed_PORT, redLed_NUM, 0);

                              setFlag(3);

                             }

                           if((pos & 0x0008)!= 0u)

                             {

                               Cy_GPIO_Write(blueLed_PORT, blueLed_NUM, 1);

                              Cy_GPIO_Write(greenLed_PORT, greenLed_NUM, 1);

                              Cy_GPIO_Write(redLed_PORT, redLed_NUM, 1);

                              setFlag(4);

                             }

               

              Regards,

              Bragadeesh

              • 4. Re: How to write firmware for a CSX button matrix on PSoC 6 Capsense? (Are there code examples online too)
                JeSi_4326976

                 

                Please use CapSense_IsMatrixButtonsActive. Please check the datasheet for more information on this API.

                 

                OMG sorry for this you clearly mentioned it earlier I messed up! So I made the changes and I can see all of the colors turn on at some point but very unreliably. I guess this is because I am using a trackpad configuration.

                 

                 

                The pattern that you have used is a typical track pad and not a matrix button. Cypress matrix button would look something like the below image. Or you can use fish bone pattern for the CapSense buttons as well. Refer to the CapSense design guide for information on the patterns.

                 

                Please let us know your application. Do you require a trackpad or a matrix button. Matrix buttons configuration is generally used when you need to have more no of buttons with lesser pins,.

                 

                 

                So my application is a tactile sensor for a robotic hand. The sensor is meant to measure the normal forces on the fingers of the hand as it closes on the objects it grips on. I believe a trackpad is better for my application as it can give a good resolution of the shape of the object being gripped, vs. a matrix which seems to require empty space which is not sensed between each button. (I would like around 60 touch pixels on a given finger, maybe a trackpad of around 8x8 or something like that).

                 

                The problem however is we cannot use a trackpad with CSX is that right? It mentions in the design guide that a new version of capsense will implement CSX trackpads in the future.

                • 5. Re: How to write firmware for a CSX button matrix on PSoC 6 Capsense? (Are there code examples online too)
                  BragadeeshV_41

                  Hi JeSi_4326976,

                   

                  If you are using a trackPad, please use the API CapSense_GetXYCoordinates (uint32 widgetId). This will return the coordinates of the touch in the trackpad.

                   

                  This API Returns the touch position of a specified touchpad widget:

                  1. If a touch is detected:

                  • Bits [31..16] indicate the Y coordinate.

                  • Bits [15..0] indicate the X coordinate.

                  2. If no touch is detected or a wrong widgetId is specified:

                  • CapSense_TOUCHPAD_NO_TOUCH.

                   

                  You can glow the corresponding LEDs based on the coordinates.

                   

                  We highly recommend using CSX trackpads since it supports multiple touches at the same time. (Your requirement involved multiple touches)

                   

                  You can use the same sensor pattern for CSX based trackpad as well.

                   

                  To test CSX trackpad we highly recommend you to evaluate our kit CY8CKIT-041-40XX PSoC 4 S-Series Pioneer Kit.

                  https://www.cypress.com/documentation/development-kitsboards/cy8ckit-041-psoc-4-s-series-pioneer-kit  that has a trackpad in it

                  We also have code examples along with this kit to show case trackpad code examples. You can also see code examples using File->Code examples in PSoC Creator.

                   

                  Regards,

                  Bragadeesh

                  2 of 2 people found this helpful
                  • 6. Re: How to write firmware for a CSX button matrix on PSoC 6 Capsense? (Are there code examples online too)
                    JeSi_4326976

                    BragadeeshV_41 Thank you so much for all your help so far. I've been able to learn capsense so much faster with your support.

                     

                    I am not sure I understand what the CapSense_GetXYCoordinates API returns. Are the x and y coordinates (both represented by 16 bit values) percentages of the distance on the given axis? For example, if I press at the very top, would it mean I should get 0 for the y coordinates, and if I press at the bottom, should I get max value? (0b1111111111111111xxxxxxxxxxxxxxxx) which would translate into 65535 if 16 bits are shifted. And then should I get something around 32500 decimal when I press in the middle of the y axis?

                     

                     

                    I tried studying the examples and tried writing code with a 3x3 CSX trackpad but I am getting messy results. Either my percentage is translated as 100% of the trackpad's length, or 0%, which makes me think I do not understand how it works. Here is what I have:

                    In the loop, I get the XY coordinates, store them in 2 ints, and convert them into % of the trackpad length (this is the part I get wrong for sure). I print those percentages and use them to dim LEDs with 2 PWM instances. Then, for debugging, I print out the raw values of pos (returns of CapSense_GetXYCoordinates).

                     

                        CapSense_Start();
                        UART_Start();
                        PWM_x_Start();
                        PWM_y_Start();
                       
                       
                        setvbuf(stdin,NULL,_IONBF,0);  //This sets NO buffering for stdin
                       
                        printf("CSX TouchPad Test Initiated..\r\n");
                      
                       
                    /*********************************************************************/
                    //LOOP
                    /*********************************************************************/
                       
                        for(;;)
                        {
                            if (!CapSense_IsBusy()) //if not busy, ask what state it's in
                            {
                                CapSense_ProcessAllWidgets();   //Performs full data processing of all enabled widgets
                               
                                uint32 pos;
                               
                                /***********************************************
                                GetXYCoordinates
                                returns a 32uint as coordinates
                                ***********************************************/
                               
                                pos = CapSense_GetXYCoordinates (CapSense_TOUCHPAD0_WDGT_ID);
                               
                               
                                if (pos == CapSense_TOUCHPAD_NO_TOUCH)
                                    printf("No touch detected\r\n");

                                int xPos = pos & 0b00000000000000001111111111111111;
                                uint32 xCompareValue = (xPos/65535)*PWM_PERIOD;
                                Cy_TCPWM_PWM_SetCompare0(PWM_x_HW, PWM_x_CNT_NUM, xCompareValue);
                                printf("finger is at %d percent on the x position\r\n", xCompareValue);
                               
                                int yPos = pos>>16;
                                uint32 yCompareValue = (yPos/65535)*PWM_PERIOD;
                                Cy_TCPWM_PWM_SetCompare0(PWM_y_HW, PWM_y_CNT_NUM, yCompareValue);
                                printf("and %d percent on the y position\r\n", xCompareValue);
                               
                                printf("--------------------------\r\n");
                               
                                /***********************************************
                                printf as binary number
                                ***********************************************/
                                while (pos) {
                                    if (pos & 1)
                                        printf("1");
                                    else
                                        printf("0");

                                    pos >>= 1;
                                    }
                                printf("\r\n");
                                }
                           
                            CapSense_UpdateAllBaselines();
                            CapSense_ScanAllWidgets();
                           CyDelay(500);
                           

                        }
                    }

                    /* [] END OF FILE */

                     

                     

                     

                     

                     

                    Examples of what I am getting from the uart.

                     

                    finger is at 100 percent on the x position
                    and 100 percent on the y position
                    --------------------------
                    11111111111111111111111111111111
                    finger is at 0 percent on the x position
                    and 0 percent on the y position
                    --------------------------
                    00000000000000001110101
                    finger is at 0 percent on the x position
                    and 0 percent on the y position
                    --------------------------
                    11011000000000000010011
                    finger is at 0 percent on the x position
                    and 0 percent on the y position
                    --------------------------
                    00000000000000000010011
                    finger is at 0 percent on the x position
                    and 0 percent on the y position
                    --------------------------
                    01010000000000000101101
                    finger is at 0 percent on the x position
                    and 0 percent on the y position
                    --------------------------

                    Thanks BragadeeshV_41 you're the best

                    • 7. Re: How to write firmware for a CSX button matrix on PSoC 6 Capsense? (Are there code examples online too)
                      BragadeeshV_41

                      Hi JeSi_4326976,

                       

                      1. The API CapSense_GetXYCoordinates returns the X and the Y coordinates of the position of your finger. The max value that is reported for the coordinates is as specified by you in the component  (Maz X axis position and Max Y axis position). Therefore it is already calibrated to give 100 as the max value for the below configuration.

                       

                      2. You will observe 0xFFFF when no sensor in the touchpad is activated. Also remember that it requires ON debounce no of scans to say that a sensor is activated or not. (ie) the sensor should be activated for ON deounce no of times to say that it is active. ON Debounce parameter is set in the Widget Details tab in the component configurator.

                       

                      3. Since you are using a 3 x 3 touch pad, you may not be able to achieve that minute changes in the coordinates.  Either increase the trackpad size or reduce the max displacement value in the configurator.

                       

                      4. To obtain the X coordinates and Y coordinates you can do the following:

                       

                      cord =  CapSense_GetXYCoordinates (CapSense_TOUCHPAD0_WDGT_ID);

                      xcord = uint16_t (cord & 0x00FF);

                      ycord = uint16_t (cord >> 16);

                       

                      5. Please test the board only with the presence of Overlays (~1 mm) for CSX to work.

                       

                      6. Use Tuner GUI to observe the rawcounts and finger tracking GUI.

                      https://www.cypress.com/documentation/code-examples/ce222827-psoc-6-mcu-capsense-tuner

                       

                      Refer to the component datasheet for information on how to interface PSoC 6 with tuner.

                       

                      7. We highly recommend you to refer to the CSX tuning guide from the CapSense design guide (Section 5.3 Manual Tuning)

                      https://www.cypress.com/file/46081/download

                       

                       

                      Regards,

                      Bragadeesh

                      2 of 2 people found this helpful
                      • 8. Re: How to write firmware for a CSX button matrix on PSoC 6 Capsense? (Are there code examples online too)
                        JeSi_4326976

                        Ok great, now I understand how coordinates are read.

                         

                         

                        1. It's the maximum x and y axis position widget parameter I should reduce if I want to try working with a 3 x 3 trackpad? I did not find a parameter called max displacement value in the configurator

                        2. I am at a point where I need to develop my first PCB with capsense electrodes, as manually etching electrodes on aluminum foil is a long process and prevents me from building much bigger than 3x3. There are a few things I need to know that I can't find in the design guides. Here is a board example:

                        Untitled.png

                             a. In this example, my TX electrodes are connected together with traces (vertical). Should I use jumpers (0805 or similar package) or vias and traces on the bottom layer to connect the RX pins (which one is optimal for noise)? And would it be better to have the direct traces for RX instead of TX?

                             b. Or else, could I have my RX or TX on the other layer? would the electrodes couple together through the PCB?

                         

                        3. You mentioned the tuner GUI. I was able to make the example code with UART work, but I was not able to use the tuner with my own application. I might be missing some steps. I simply followed the steps for the UART you sent me https://www.cypress.com/file/46081/download , but I could not connect: it indicated request packet not found after a few seconds when clicking on connect

                        • 9. Re: How to write firmware for a CSX button matrix on PSoC 6 Capsense? (Are there code examples online too)
                          BragadeeshV_41

                          Hi JeSi_4326976,

                           

                          1. What is the area of the trackpad you are looking for in your application?

                          2. Thickness and material of the overlay.

                           

                          It's the maximum x and y axis position widget parameter I should reduce if I want to try working with a 3 x 3 trackpad? I did not find a parameter called max displacement value in the configurator

                          -> Apologies, I meant Maz X axis position and Max Y axis position.

                           

                          Could you please explain your application, "I would like around 60 touch pixels on a given finger, maybe a trackpad of around 8x8 or something like that". Our present touchpad algorithm can detect up to 3 finger touches in the trackpad at the same time. It will better if you could let us know the application/ video of the application so that we can guide you better.

                           

                          It is better to have the TX and RX segments on the same layer.

                          You can either connect all the TX in one layer and use vias for the RX segments or vice versa. It will not affect the performance.

                           

                          Also, the gap between the Tx and Rx segments should be around half of the overlay thickness. For example, if the thickness of the overlay is 3 mm, then the gap between the tx and rx segments can be between 1.2 to 1.5 mm not more that. If the gap between the tx and rx segments is greater than overlay thickness, then there won't be much Cm formed between the Tx and Rx segments.

                          You can use the 4000S pioneer kit's touchpad layout for reference.

                           

                          Question: You mentioned the tuner GUI. I was able to make the example code with UART work, but I was not able to use the tuner with my own application. I might be missing some steps. I simply followed the steps for the UART you sent me https://www.cypress.com/file/46081/download , but I could not connect: it indicated request packet not found after a few seconds when clicking on connect

                           

                          -->Could you please share the PSoC Creator project .

                          Use advanced editor option to upload files. Since the file size could be large, archive the project using the steps mentioned in the following KBA Archiving a PSoC Creator Design

                           

                          Regards,

                          Bragadeesh

                           

                           

                          2 of 2 people found this helpful
                          • 10. Re: How to write firmware for a CSX button matrix on PSoC 6 Capsense? (Are there code examples online too)
                            JeSi_4326976

                            APPLICATION

                             

                            1. Sensing area of final application: 22 mm per 37 mm (can be more or less modified)

                            2.overlay is metal doped silicone, 2mm (yet it behaves like foam and compresses as force is applied)

                            1.png

                             

                            The application is a tactile sensor placed at the tip of a robotic hand's fingers (one sensor per finger, 2 fingers on the hand)
                            The hand needs to be able to sense the objects it is gripping on. It needs to sense the shape of the object, so we had 28 CSD buttons on the last version of the project (shown on picture 1). We called those the static part of the sensor (in gold on the image). As the compressive overlay becomes more compressed, the sensors read a higher normal force applied on them, which is how we were able to determine the shape of objects and forces applied across the sensor like on picture 2.
                            We also had a 29th sensor which was an electrode surrounding all of the others and covering the whole space of the PCB that is not the static part. This huge electrode served to sense variations of force when an object was gripped/ungripped, and was called the dynamic part (in green).

                             

                            2.png

                            3.png

                             

                            NEW VERSION

                             

                            I am new in my lab, they are the ones who developed the previous version of the app I just described. Now I had to learn how to use PSoC products because they are really popular in my lab, and of course we want to use a PSoC 6 for the new version of the tactile sensor. We wanted to try the possibilities with CSX sensing, hence why I have been asking a million questions about how to setup a matrix and a trackpad. This is for a master's thesis, however the final product, once fully developed, should be implemented in the robotic hand shown above, which is a commercial product.

                             

                            QUESTIONS

                             

                            With a 2mm overlay, I will use a max 1mm gap between the electrodes of my touchpad, as you explained.

                            1. But the 3 fingers at a time for CSX touchpads seems problematic if I want to be able to tell the shape of the gripped object? It might not be able to read a complex shape like the mug handle on picture 2?

                             

                            2. I attached the file I wanted to use the tuner with but did not succeed.

                            • 11. Re: How to write firmware for a CSX button matrix on PSoC 6 Capsense? (Are there code examples online too)
                              BragadeeshV_41

                              Hi JeSi_4326976,

                               

                              1. Will there be an air-gap between the sensors and the overlay or overlay and metal foam?

                               

                              2. If you are using a touchpad, you will be able to find out only 3 fingers with the present algorithm we have.  In case  you are going to grip the object, there could be multiple sensors triggered at the same time (more than 3). If you need to exactly map more than 3 contact points then you may have to develop your own algorithm.

                               

                              3. How is the algorithm designed to detect the object shape (if it can be disclosed). I'm assuming, you will find out which all sensors are triggered and you will find the shape from that. If that is case, I'm assuming you wanted to reduce the no of pins used (presently at 28?) using matrix configuration. Matrix configuration using CSD technique will lead to ghost touches effect when multiple sensors are triggered. So you need to use CSX in this case. But we have not tested CSX as a force measuring sensor. So this is something that you may have to test and develop.  Please share the dimensions of the buttons in the present configuration using CSD.

                               

                              4. You need to calibrate with the metal foam at top, since it will add to the capacitance.

                               

                              Please refer to the Code example on how to interface Tuner interface using UART or I2C.

                              https://www.cypress.com/documentation/code-examples/ce222827-psoc-6-mcu-capsense-tuner

                               

                              Regards,

                              Bragadeesh

                              2 of 2 people found this helpful
                              • 12. Re: How to write firmware for a CSX button matrix on PSoC 6 Capsense? (Are there code examples online too)
                                JeSi_4326976

                                 

                                1. Will there be an air-gap between the sensors and the overlay or overlay and metal foam?

                                 

                                No, the PVDF overlay (dielectric) is laying directly over the PCB, and the grounded fabric is placed on top.

                                 

                                IO2.png

                                 

                                2. If you are using a touchpad, you will be able to find out only 3 fingers with the present algorithm we have.  In case  you are going to grip the object, there could be multiple sensors triggered at the same time (more than 3). If you need to exactly map more than 3 contact points then you may have to develop your own algorithm.

                                 

                                I will try a first iteration with a trackpad on a custom board presented down here. As you mentioned earlier, we might go for the 4000S pioneer kit if we cannot manage to make it work. I just wanted to use PSoC 6 though.

                                 

                                *THIS IS A CSX FIRST ATTEMPT, NOT THE PREVIOUS WORKING APPLICATION WE HAD WITH CSD

                                IO.png

                                Here, I believe it is ready for fab: Its a 5x5 trackpad with 5 TX pins and 5 RX pins to connect to a psoc 6 pioneer devboard. I added a partially filled ground plane around the pads (not in between them) as this doc https://www.cypress.com/file/141996/download mentions:

                                When board height restrictions are not important and there is nothing of consequence close to the non-sensor side of the PCB, run the sense traces along the non-sensor layer of the PCB and via them to the sensors. The ground plane is located on the top layer of the board to protect the system from accidental detection through interaction with the sense lines rather than the sensors

                                So I believed on this board with nothing but the pads I should put my sensing traces on the bottom layer, and the ground plane on the top (sensors) layer. Right?

                                 

                                 

                                 

                                3. How is the algorithm designed to detect the object shape (if it can be disclosed). I'm assuming, you will find out which all sensors are triggered and you will find the shape from that. If that is case, I'm assuming you wanted to reduce the no of pins used (presently at 28?) using matrix configuration. Matrix configuration using CSD technique will lead to ghost touches effect when multiple sensors are triggered. So you need to use CSX in this case. But we have not tested CSX as a force measuring sensor. So this is something that you may have to test and develop.  Please share the dimensions of the buttons in the present configuration using CSD.

                                 

                                 

                                 

                                Each of the 28 pads were read one at a time and the number of counts varied depending on how compressed the sensor was at that given time. So we see which are triggered, but the response was also linear to the applied force.

                                The CSD pads had a 4.8mm side length.

                                 

                                The purpose of switching to a matrix (or trackpad) CSX was as you guessed to increase the resolution of the sensor.

                                I believe CSX matrix would have been an interesting thing to try, but since there is a minimum distance between each button, which is not desirable. The document shared on point 2  does not clearly mention how small button-button clearance can be (p. 3), so I actually wonder if it is doable to put them almost as tightly together as it is for a touchpad config? The doc mentions we need to tie the buttons to ground to reduce their interactions, I guess this refers to placing a gnd plane around the matrix?

                                 

                                 

                                Please refer to the Code example on how to interface Tuner interface using UART or I2C.

                                https://www.cypress.com/documentation/code-examples/ce222827-psoc-6-mcu-capsense-tuner

                                 

                                I was able to make the code example work. I will read further to find out why it won't work with my own app.

                                • 13. Re: How to write firmware for a CSX button matrix on PSoC 6 Capsense? (Are there code examples online too)
                                  BragadeeshV_41

                                  Hi JeSi_4326976,

                                   

                                  In CSX sensors, we usually recommend not to place any ground right below the sensors. This is because the Cm formed is due to the field lines going from the Tx to Rx segments. When you place a ground plane right below the sensors(thickness of PCB < gap between Tx and Rx segments), then the field lines from Tx will reach the ground instead of Rx segment. This results in a very low Cm value. We recommend the Cm between the tx and rx segments to be around  900fF to 4 pF. Also the clearance between the sensors and the ground in the same layer should be such that it should be greater than tx-rx gap width for the same reason mentioned above.

                                   

                                  Touchpad can give you a higher resolution when compared to a matrix button in terms of touch position. But you may have to develop the firmware for multiple points detection (you can read the raw counts of all the sensors and find the maxima points).

                                   

                                  The doc mentions we need to tie the buttons to ground to reduce their interactions, I guess this refers to placing a gnd plane around the matrix?

                                  -> This refers to connecting the inactive sensor connection to ground. For CSX sensors this is done automatically by the component.

                                   

                                  Please refer to AN85951 PSoC® 4 and PSoC 6 MCU CapSense® Design Guide for guidelines for PSoC 4 and PSOC 6 MCUs. you are referring to design guidelines for an old device which may or may not be applicable for the latest capsense devices.

                                   

                                  You may also be interested to evaluate our inductive sensing solution where it primarily used to detect deflection of metals by change in inductance.

                                  AN219207 - Inductive Sensing Design Guide

                                  https://www.cypress.com/documentation/application-notes/an219207-inductive-sensing-design-guide 

                                   

                                  Regards,

                                  Bragadeesh