5 Replies Latest reply on Apr 17, 2020 6:54 AM by BragadeeshV_41

    ModusToolBox - Accessing Capsense Widget Raw Counts

    KeEv_4623571

      Hello All,

       

      I am having trouble accessing the raw counts on a capsense widget in modustoolbox.  I would think that it would be populated in the raw location within the sensorContext struct within the cy_capsense_tuner data structure, however I'm uncertain if that field is populated when the tuner is not running?  If not, is there another way to access the information I want?

       

      Looking at this thread:

      Mutual Capacitance Calculation of a CapSense Sensor Through Firmware - KBA222425

       

      It makes reference to a function "CapSense_GetParam" function, but my understanding is that this is not available in modustoolbox?

       

      Thanks,

      Kent

        • 1. Re: ModusToolBox - Accessing Capsense Widget Raw Counts
          BragadeeshV_41

          Hi KeEv_4623571,

           

          There is no equivalent to GetParam and SetParam in CapSense Middleware 2.0 yet. The future versions of the middleware will have these functions implemented. For now, you can access the raw data directly from the Data structure. You can upgrade to the lasted version once it is released.

           

          Regards,

          Bragadeesh

          2 of 2 people found this helpful
          • 2. Re: ModusToolBox - Accessing Capsense Widget Raw Counts
            KeEv_4623571

            Hi Bragadeesh,

             

            Okay that's too bad.  Glad to hear the feature is incoming though.

             

            With regards to the data structure.  I presume the referenced data structure is cy_capsense_context and the actual counts are stored in cy_capsense_tuner.sensorContext.  I have been monitoring these fields but nothing seems to change even when shorting the tx and rx electrodes.  I am calling scanallwidgets and then processallwidgets, is there something more I need to do?

             

            Thanks,

            Kent

            • 3. Re: ModusToolBox - Accessing Capsense Widget Raw Counts
              BragadeeshV_41

              Hi KeEv_4623571,

               

              For now the best way to access the raw data is using the cy_capsense_tuner structure. You can find the register map in the file cycfg_capsense.h in the following location

              PROJ_DIRECTORY\PROJ_NAME\libs\TARGET_CY8CKIT-062-  BLE\COMPONENT_BSP_DESIGN_MODUS\GeneratedSource\cycfg_capsense.h . You should find the exact variables to access for the required sensors. Attached a sample snapshot below.

               

              The PARAM_ID is created for future use by the GetParam and SetParam functions.

               

              Please check if you are observing a change in rawcounts when you touch the sensor instead of shorting them.

               

              Regards,

              Bragadeesh

              1 of 1 people found this helpful
              • 4. Re: ModusToolBox - Accessing Capsense Widget Raw Counts
                KeEv_4623571

                Hi BragadeeshV_41,

                 

                Yes, sorry for being unclear.  I have tried many ways of changing the capacitance value not just shorting the electrodes.  I am monitoring on the scope as well (see below) with no success in reading different count values.  It's in a thread on FreeRTOS so I'm wondering if that's the issue.

                 

                No finger touch

                20200416_125610.jpg

                finger touching

                20200416_130153.jpg

                 

                By these accounts I would think I would be getting different counts, but no, just zero counts the whole time :/

                 

                Best,

                Kent

                • 5. Re: ModusToolBox - Accessing Capsense Widget Raw Counts
                  BragadeeshV_41

                  Hi KeEv_4623571,

                   

                  When a finger is placed on a CSX electrode, the mutual capacitance between them decreases slightly. This can not be observed using a waveform unless the the change is very significant. Could you please attach your project so that we can check what is the issue?

                  Is it a custom board or one of the cypress kits that you are using? FreeRTOS is not a problem. But make sure that this task gets time to run every refresh interval time and is not preempted by higher priority task. Did you have a chance to view the sensor data using CapSense Tuner?

                   

                  Regards,

                  Bragadeesh

                  1 of 1 people found this helpful