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

APP_BUTTON Event Not Firing

Sorry but I've been stuck on this for a few days now and I have to give up and ask for help.

I'm attempting to set LED0 when BUTTON_0 is pressed and LED1 when BUTTON_1 is pressed but the button_event_handler(...) is never called.

I initialize APP_TIMER, APP_GPIOTE, APP_BUTTON and call the app_button_enable() function but still cannot detect button presses.

I know the code is downloaded correctly to the flash because I can debug it and also have UART working so I get output.

BTW I'm using GCC + Eclipse with the NRF51822 Eval Kit.

Can anyone give me a hint what I'm doing wrong?

Thank you.

Hello World.zip

Parents
  • The app_button module uses app_timer to do button debouncing. When using app_timer without the softdevice, you have to manually start the low-frequency clock, for example like this:

    
    static void lfclk_config(void)
    {
        NRF_CLOCK->LFCLKSRC             = (CLOCK_LFCLKSRC_SRC_Xtal << CLOCK_LFCLKSRC_SRC_Pos);
        NRF_CLOCK->EVENTS_LFCLKSTARTED  = 0;
        NRF_CLOCK->TASKS_LFCLKSTART     = 1;
        while (NRF_CLOCK->EVENTS_LFCLKSTARTED == 0)
        {
            //Do nothing.
        }
        NRF_CLOCK->EVENTS_LFCLKSTARTED = 0;
    }
    
    

    This is from the RTC example of the SDK.

  • Hello @Ole Morten

    I am also struggling with Timer interrupt. I want to see the button_debouncing handling using 'timers'. As you mentioned here that app_button uses app_timer for button_debouncing. Please explain me in little detail, how its working (button_debouncing), as i am using SoftDevice SD110 and want to read the button_pin_value when debounce. Please suggest some solution.

    Thanks n Regards

Reply
  • Hello @Ole Morten

    I am also struggling with Timer interrupt. I want to see the button_debouncing handling using 'timers'. As you mentioned here that app_button uses app_timer for button_debouncing. Please explain me in little detail, how its working (button_debouncing), as i am using SoftDevice SD110 and want to read the button_pin_value when debounce. Please suggest some solution.

    Thanks n Regards

Children
No Data
Related