This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

BUTTON_1 release issue

I expanded the button events based on example ble_peripheral ble_app_hrs by

bsp_event_to_button_action_assign (0, BSP_BUTTON_ACTION_RELEASE, BSP_EVENT_KEY_0_RELEASE);
bsp_event_to_button_action_assign (1, BSP_BUTTON_ACTION_RELEASE, BSP_EVENT_KEY_1_RELEASE);
bsp_event_to_button_action_assign (2, BSP_BUTTON_ACTION_RELEASE, BSP_EVENT_KEY_2_RELEASE);
bsp_event_to_button_action_assign (3, BSP_BUTTON_ACTION_RELEASE, BSP_EVENT_KEY_3_RELEASE);

and everything works fine (button press and button release events for all 4 buttons) till I connect the device:

Then button_1 release event (in code: BSP_EVENT_KEY_0_RELEASE) does not appear further more - I do not receive the event also after disconnecting.

Any hint what prevents this event?

Parents
  • Hi.

    So being in a connection prevents you from getting events from the button release? That sounds strange.

    Could you add information about what device, SDK version, SD version etc. you are working with?

    Br,
    Joakim

  • 2 devices: rF52840 DK and costomized HW with SDK 16.0

    all the same behaviour: button 1 release is not working, other button releases (2 to 4) are working well.

    btw.: I have disabled sleep_mode_enter() in on_adv_evt(case BLE_ADV_EVT_IDLE) and in bsp_event_handler(case BSP_EVENT_SLEEP) because I need no power saving so far.
    Could it be the bonding to wake the device : remark for buttons_leds_init() - If yes, how to disable it?

    KR Peter

  • Hi Joakim,

    further investigation with 5 active buttons (code for pca10056.h shown in code box)

    #define BUTTONS_NUMBER 5  // 4
    
    //#define BUTTON_1       11
    #define BUTTON_1       NRF_GPIO_PIN_MAP(1,07)  // dummy
    #define BUTTON_2       11
    #define BUTTON_3       12
    #define BUTTON_4       24
    #define BUTTON_5       25
    #define BUTTON_PULL    NRF_GPIO_PIN_PULLUP

    shows that a workaround would be possible with avoid using button_1 (here set as a dummy port).

    All events for BUTTON_2 to BUTTON_5 are working well now.

    The missbehaviour keeps linked to BUTTON_1 which seems to have a special function.

    How to disable this special function?

    Thank you for all hints & KR

    Peter

    P.S.: sdk_config.h needs to be changed in one line:

    // <o> GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS - Number of lower power input pins 
    #ifndef GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS
    #define GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS 5 // 4 <---
    #endif

  • Have you made sure that there isn't a reference to BUTTON_1 elsewhere in your project that might be keeping you from getting the events after connection?

    Br,
    Joakim

  • Well, that's exactly the question. Because it is Nordic's example, I do not know: I have to return that question to the Nordic developers.

    As I wrote before I extended the ble_app_hrs_pca10056_s140 example with the BSP_BUTTON_ACTION_RELEASE functions - no further reference to BUTTON_1!

  • I see. 

    You can see what the button assignments for the native example here: 
    BSP BLE Button Assignments 

    In your example, you still have the original events in your bsp event handler. I only have your main.c file, so I don't know what other changes you have made. 

    You can see the functions for configuring the buttons in the bsp_btn_ble.c file. Both for connection and advertising. 

  • Hi Joakim,

    thank you for pointing to file bsp_btn_ble.c!

    I modified the lines

    //2020-06-28 pam wakeup and sleep functions disabled
    //by assigning them to button #5 that is not configured
    #define BTN_ID_WAKEUP             5 //0  /**< ID of button used to wake up the application. */
    #define BTN_ID_SLEEP              5 //0  /**< ID of button used to put the application into sleep mode. */
    #define BTN_ID_DISCONNECT         5 //0  /**< ID of button used to gracefully terminate a connection on long press. */
    #define BTN_ID_WAKEUP_BOND_DELETE 5 //1  /**< ID of button used to wake up the application and delete all bonding information. */
    #define BTN_ID_WHITELIST_OFF      5 //1  /**< ID of button used to turn off usage of the whitelist. */
    
    #define BTN_ACTION_SLEEP          BSP_BUTTON_ACTION_LONG_PUSH //BSP_BUTTON_ACTION_RELEASE    /**< Button action used to put the application into sleep mode. */
    #define BTN_ACTION_DISCONNECT     BSP_BUTTON_ACTION_LONG_PUSH  /**< Button action used to gracefully terminate a connection on long press. */
    #define BTN_ACTION_WHITELIST_OFF  BSP_BUTTON_ACTION_LONG_PUSH  /**< Button action used to turn off usage of the whitelist. */

    to disable all the configured functions for wakeup, sleep, etc. and now it works!

    KR Peter

Reply
  • Hi Joakim,

    thank you for pointing to file bsp_btn_ble.c!

    I modified the lines

    //2020-06-28 pam wakeup and sleep functions disabled
    //by assigning them to button #5 that is not configured
    #define BTN_ID_WAKEUP             5 //0  /**< ID of button used to wake up the application. */
    #define BTN_ID_SLEEP              5 //0  /**< ID of button used to put the application into sleep mode. */
    #define BTN_ID_DISCONNECT         5 //0  /**< ID of button used to gracefully terminate a connection on long press. */
    #define BTN_ID_WAKEUP_BOND_DELETE 5 //1  /**< ID of button used to wake up the application and delete all bonding information. */
    #define BTN_ID_WHITELIST_OFF      5 //1  /**< ID of button used to turn off usage of the whitelist. */
    
    #define BTN_ACTION_SLEEP          BSP_BUTTON_ACTION_LONG_PUSH //BSP_BUTTON_ACTION_RELEASE    /**< Button action used to put the application into sleep mode. */
    #define BTN_ACTION_DISCONNECT     BSP_BUTTON_ACTION_LONG_PUSH  /**< Button action used to gracefully terminate a connection on long press. */
    #define BTN_ACTION_WHITELIST_OFF  BSP_BUTTON_ACTION_LONG_PUSH  /**< Button action used to turn off usage of the whitelist. */

    to disable all the configured functions for wakeup, sleep, etc. and now it works!

    KR Peter

Children
No Data
Related