Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

button interruption in nRF52805

excuse me,I'm developing nRF52805 and I set the button pin number like this:
#define BUTTON_START 1
#define BUTTON_1 1
#define BUTTON_2 5
#define BUTTON_3 12
#define BUTTON_4 16
#define BUTTON_STOP 16
what's more, I define like this in advertising_buttons_configure
err_code = bsp_event_to_button_action_assign(0,
BSP_BUTTON_ACTION_PUSH
BSP_EVENT_KEY_0);
RETURN_ON_ERROR_NOT_INVALID_PARAM(err_code);
err_code = bsp_event_to_button_action_assign(1,
BSP_BUTTON_ACTION_PUSH
BSP_EVENT_KEY_1);
RETURN_ON_ERROR_NOT_INVALID_PARAM(err_code);
err_code = bsp_event_to_button_action_assign(2,
BSP_BUTTON_ACTION_PUSH
BSP_EVENT_KEY_2);
RETURN_ON_ERROR_NOT_INVALID_PARAM(err_code);
however, only BSP_EVENT_KEY_0 in bsp_event_handler can produce interruption when I give the pin number 1 a high level.
The other pins(5 and 12) produce BSP_EVENT_KEY_1 and BSP_EVENT_KEY_2 interruption periodically, but I don't give them high level.
Hope you can help me.

Parents Reply Children
  • 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

Related