Capsense sensing delay using custom capsense board

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
TaH_4345166
Level 2
Level 2
5 likes given First like received First like given

Hello,

I am using CY8CKIT-042 PSoC® 4 Pioneer Kit. I am using it for the CapSense design with 10 buttons and 2 sliders.

We are observing a delay in sensing the capsense buttons. That means, we are trying to blink led's depends on the button touch and there is a second delay between the touch and led light up.

I am thinking the API's used to find the widget active status is causing it.

Here is a piece of code we are using. Let us know the execution time of these API's and if we have to use any other logic to use with.

/* Mian entry function for CapSense steering wheel swicth */

int main(void)

{

    /* Initialize CapSense Component */

    CapSense_Start();

    /* Scan all widgets */

    CapSense_ScanAllWidgets();

    for(;;)

    {

        /* Do this only when a scan is done */

        if(CapSense_NOT_BUSY == CapSense_IsBusy())

        {                                                                                                                                       

            /* Process all widgets ( Buttons & Sliders ) */

            ProcessAllWidgets();

            /* Again scan all widgets */

            CapSense_ScanAllWidgets(); /* Start next scan */

        } 

    }

void ProcessAllWidgets()

{

    CapSense_ProcessAllWidgets();      /* Process all widgets */

     if (CapSense_IsAnyWidgetActive())  /* Scan result verification */

     {

        if (CapSense_IsWidgetActive(CapSense_BUTTON0_WDGT_ID))

        {

            flagb0 = 1u;      

        }

        else if(CapSense_IsWidgetActive(CapSense_BUTTON1_WDGT_ID))

        {

            flagb1 = 1u;

        }

     if(flagb0 || flagb1)

     {

     /* Light up LED's */

     }

    }

}

Please let us know the execution time the below API's to conclude on the delay we are facing.

CapSense_ScanAllWidgets()

CapSense_ProcessAllWidgets()

CapSense_IsAnyWidgetActive()

CapSense_IsWidgetActive(CapSense_BUTTON0_WDGT_ID)

And how we have to handle multiple widgets in a project? Is there anyway to avoid if else condition as above as we have 10+ buttons in the project?

0 Likes
1 Solution
BragadeeshV
Moderator
Moderator
Moderator
First question asked 1000 replies posted 750 replies posted

Hi TaH_4345166​,

The response time of the sensor depends on multiple factors:

1. Scan time of the sensors - Depends on resolution and modulator clock frequency. Reducing these parameters helps in reducing the response time. But make sure that you have a SNR of at least 5:1 for reliable operation.

2. Debounce parameter - Number of consecutive scan samples for which the touch should be present for it to become valid. This value is set according to the noise conditions in the system. The default value is 3. Decreasing this leads to reduced scan time.

3. Manual tuning - Allows you to have strict control over for the scan time since you can set the minimum N and Mod clock with minimum SNR requirements (> 5:1)

4. Usage of Firmware filters in advanced tab will cause the processing time of  ProcessAllWidgets to increase. Try using minimum filters to reduce response time.

There is no standard execution time for these API's. It purely depends on your configuration and design. If you wish to measure the execution time for these API's you need to use a PSoC TCPWM timer or an oscilloscope.

For example, execution time of ScanAllWidgets depends on the scan time of sensors, no of sensors and if any entry or exit callbacks defined.

Execution time of ProcessAllWidgets depends on the firmware filters, debounce parameter etc.

Also note that the scan time of the sensor is the sum of the hardware scan time and the sensor initialization time during each scan.

Regards,

Bragadeesh

Regards,
Bragadeesh

View solution in original post

7 Replies