- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm attempting to use the CapSense_CSD_P4 to enable a proximity sensor. I downloaded and ran the example project and all goes well. If I try to add a simple button everything breaks.
The proximity sensor reads fine until you press the button, which then causes the proximity sensor to read its max value 255 indefinitaly.
Attached is an example project. All I did was take the example proj from Cypress and add a debouncer with pin. So if you run it with a proximity attached and a button here is what happens:
1. Code loads fine
2. As you move your hand closer to proxmity sensor red LED on pioneer board changes intensity (working fine)
3. If you press the button the led goes to full bright
4. Proximity sensor no longers works. Code is in some type of deadlock.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Max clock for the debouncer is 200Hz.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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 .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Are you using the Switch to wake up the device from Sleep mode?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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 😞
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You don't need to have a voltages on your switch just ground. You can select a pull up resistor on P0.5 That way all your switch needs is a ground connection. One other thing use Volatile for your interrupt variable.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
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.
Thanks,
Yuva.