Max clock for the debouncer is 200Hz.
So are you using a CY8CKIT-042 Ble kit? Looking at your program I found that your pin selections where incorrect for the example. I have made the changes along with the clock change that Bob Marlowe gave you. I am also using PSOC Creator 4.0
That's correct, I'm using the CY8CKIT-042 Ble Pioneer kit. So I opened your project but was met with the attached errors. So to fix it I changed the clock to 200kHz instead of 200Hz.
However, using your project with the updated pins the program is still deadlocking the same as before. Any other ideas? I can try to record a video and upload if that will help .
After a little more debugging it seems that whenever I press the button, this line is always returning true...
/* Check if proximity sensor is active - thresholds are dynamically calculated during run-time
proximityActive variable will have a non-zero value if Proximity was active */
proximityActive = CapSense_CheckIsSensorActive(PROXIMITY_SENSOR_INDEX);
Just found something else that may help. I'm using one of these push buttons.
- Now, when I move my hand closer to the proximity sensor the LED intensity goes up and down.
- When I press the button, the LED intensity goes full bright and now the proximity does nothing.
- Now, if I hold down the button, the proximity sensor works (aka step 1 is possible)
- If I let go of the button I get stuck in step 2.
It seems like something is getting stuck high? or low? and not going back after the button is released...but I have no idea what that would be.
Which to be honest I have no idea why pressing the button changes the LED state at all, it's not connected to it any way.
Can I ask why you are using a Debouncer component? The CapSense has Debounce. Also why are you not using a CapSense button? Can you send a block diagram of your circuit so I can better understand what you are trying to do.
Are you using the Switch to wake up the device from Sleep mode?
I have two input methods: capsesense proximity and push button. I was using the debouncer to handle the push button. I'm not using the switch to do anything at the moment. When the switch is selected it simply triggers the ISR, that's it.
I'm attaching a file of the board (ignore the other wires and the second push button, I'm only using the first) and also a file of a video so you can see what's happening.
I can't see the complete board in your picture so I am not able to determine what pins you are using. Also I have no information on how your switch is connected. I have tried it on my board using a wire to connect P0.5 to ground to simulate a switch and I don't see you issue. I do have some issues with it latching up at random times but I think this is due to the wire picking up stray signals. I am sending you an updated program. I have a frequency divider to bring down the clock for the Debouncer component.
Trying your example project I'm getting the same weird functionality. I'm not sure why pressing the button is having any effect on the proximity readings...still trying to debug through it.
If worse comes to worse, and I admit defeat, I'll just switch to polling the button rather than relying on an ISR. Not ideal but it'll work I guess :(
Can you check the capsense data (rawcount, baseline, signal) using the tuner example project and share your observations? Also one more point to be noted is that your sensor setup is not rigid and move when touched which can cause huge variation in the capacitance resulting increase in rawcount more than noise threshold configured which causes stuck-up situation. You may check the manual tuning section available in the CapSense Design Guide to get more details.