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
  • 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

  • Thanks for you help, A B C D is like this.
    Pad pushed
    Pad not pushed
    GND->Output
    0
    3.328V
    VDD->Output
    -3.328V
    0
    Best regards.

  • 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

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

Children
No Data
Related