cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 4 MCU

Anonymous
Not applicable

Hello,

I am trying to run a proximity sensor using CY8C4025LQI-S411 chip. I've created a CapSense component, configured it to use a proximity sensor with two sensors, shield and shield tank capacitor - all according to the hardware design on hand. However, I don't seem to get any response from the IsProximitySensorActive method. I can see the measurements change when I move my hand over the sensor, using the sensors' raw data directly; however, no matter how I change the configuration or program code, I can't get the CapSense working.

How do I know if I should change the CapSense component configuration, program code or hardware design? What do I have to do to determine the source of the problem?

Below is the source code of main() function that I'm currently using. Is there anything wrong with it?

    CapSense_1_CSDSetupWidget(0);

    CapSense_1_Start();

    CapSense_1_InitializeAllBaselines();

    for(;;)

    {       

        CapSense_1_ProcessAllWidgets();

       

        while (CapSense_1_IsBusy())

        {

            ;

        }

       

        CapSense_1_UpdateAllBaselines();

        if (CapSense_1_IsProximitySensorActive(0, 0))

        {

            Pin_1_Write(1);

        }

        else

        {

            Pin_1_Write(0);

        }

       

        CyDelay(5);

    }

0 Likes
Reply
1 Solution
Employee

Hello,

I see that you have not scanned your proximity sensor. You need to scan after setting up the widget. Then, check until the scanning is complete (while loop), followed by processing of the widget.

You can refer to code examples CE210291 or CE210289.

You could also refer to Scan APIs in the the CapSense component datasheet.

Thanks,
Shanmathi

View solution in original post

0 Likes
Reply
3 Replies
Esteemed Contributor II

Proximity sensors have to be enabled first, before they can be red using IsProximitySensorActive() API.

Bob

0 Likes
Reply
Employee

Hello,

I see that you have not scanned your proximity sensor. You need to scan after setting up the widget. Then, check until the scanning is complete (while loop), followed by processing of the widget.

You can refer to code examples CE210291 or CE210289.

You could also refer to Scan APIs in the the CapSense component datasheet.

Thanks,
Shanmathi

View solution in original post

0 Likes
Reply
Anonymous
Not applicable

Thank you! I actually was scanning the component once, but one wasn't set up correctly at the time and the Scan() method got lost somewhere in the experiments.

Following your guideline made it actually work.

0 Likes
Reply