Hello,
Are the button pins connected to anything, or are the pins floating?
Do you have a define called BUTTON_PULL in the same file as your BUTTON_START definition? What is it set to?
The BSP library is handling the logic around button presses, but the buttons are actually set up using app_button_init(), which is called in bsp_init() in bsp.c. It uses the array called app_buttons in the example that you refer to. What does that look like in your case?
Best regards,
Edvin
|
Pad pushed
|
Pad not pushed
|
|
|
GND->Output
|
0
|
3.328V
|
|
VDD->Output
|
-3.328V
|
0
|
Ok, so that suggests that the pad is an active output, which doesn't only pull up or down. The pin is never floating. When the pad is pushed, the pin outputs 0, and when the pad is not pushed it outputs high.
In this case, you should not use any pullup or pulldown by using NRF_GPIO_PIN_NOPULL instead of NRF_GPIO_PIN_PULLUP.
active state should be 0 (false), like it is.
Try this, and see what happens. If you still see issues, please try to analyze the pad output using a logic analyzer. How long is the output low when you push it, or only for a few ms? Is held low while you hold it? Is it stable, or does it contain bounce?
Best regards,
Edvin
Maybe it is the problem caused by poor contact, I will make it stable and try again these days, thank you very much.
It may be.
Please note that the app_button, and hence the bsp library has a software debounce, meaning that the pulse must be active (LOW in this case) continuously for 50ms by default. The time (50ms) is configurable, but if the pad already has a debounce (since it may be a "smart device", compared to a mechanical button), it may be that it outputs a pulse shorter than 50ms. If so, you may also try out the example pin_change_int, which is a very simple gpio change detector without debounce. You can give it a go if you like.
But it may also be a poor contact. Or perhaps it doesn't have the drive strength to pull down the pullup set in app_button. Try to set it to NRF_GPIO_PIN_NOPULL, as I suggested in the previous reply.
Best regards,
Edvin
It may be.
Please note that the app_button, and hence the bsp library has a software debounce, meaning that the pulse must be active (LOW in this case) continuously for 50ms by default. The time (50ms) is configurable, but if the pad already has a debounce (since it may be a "smart device", compared to a mechanical button), it may be that it outputs a pulse shorter than 50ms. If so, you may also try out the example pin_change_int, which is a very simple gpio change detector without debounce. You can give it a go if you like.
But it may also be a poor contact. Or perhaps it doesn't have the drive strength to pull down the pullup set in app_button. Try to set it to NRF_GPIO_PIN_NOPULL, as I suggested in the previous reply.
Best regards,
Edvin