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

App_button event doesnt work on application with FreeRTOS and buttonless DFU.

I am developing application with buttonles BLE DFU and FreeRTOS. 
I needed debounce on buttons and decided to use app_button. Here is my init: 

    //The array must be static because a pointer to it will be saved in the button handler module.
    static app_button_cfg_t buttons[] =
    {
        {DISPLAY_UP_BUTTON, false, BUTTON_PULL, display_button_event_handler},
        {DISPLAY_DOWN_BUTTON, false, BUTTON_PULL, display_button_event_handler},
        {DISPLAY_LEFT_BUTTON, false, BUTTON_PULL, display_button_event_handler},
        {DISPLAY_RIGHT_BUTTON, false, BUTTON_PULL, display_button_event_handler}
    };

    err_code = app_button_init(buttons, ARRAY_SIZE(buttons),
                               BUTTON_DETECTION_DELAY);
    APP_ERROR_CHECK(err_code);


I turn on log debug on app_timer and app_button. Thats what I get:
<debug> app_button: First active button, starting periodic timer
<debug> app_timer: Start request (expiring at 13994/0x000036AA).
<debug> app_timer: Timer preempted.
<debug> app_timer: Activating timer (CC:13994/000036AA).
<debug> app_timer: Setting CC to 0x000036AA (err: 0)

And nothing happens if I push button again. 

The strange thing that I see log debug on freeRTOS timer only for 14 times. Here is my full log from start:
<info> app: Setting vector table to bootloader: 0x000F1000
<info> app: Setting vector table to main app: 0x00027000
<info> app: ble dfu svci init res 0
<info> app_timer: RTC: initialized.
<debug> app_timer: Start request (expiring at 1024/0x00000400).
<debug> app_timer: Activating timer (CC:1024/00000400).
<debug> app_timer: Setting CC to 0x00000400 (err: 0)
<debug> app_timer: Compare EVT
<debug> app_timer: Timer expired (context: 0)
<debug> app_timer: Activating timer (CC:2048/00000800).
<debug> app_timer: Timer expired (context: 0)
<debug> app_timer: Timer expired before scheduled to RTC.
<debug> app_timer: Activating timer (CC:3072/00000C00).
<debug> app_timer: Timer expired (context: 0)
<debug> app_timer: Timer expired before scheduled to RTC.
<debug> app_timer: Activating timer (CC:4096/00001000).
<debug> app_timer: Timer expired (context: 0)
<debug> app_timer: Timer expired before scheduled to RTC.
<debug> app_timer: Activating timer (CC:5120/00001400).
<debug> app_timer: Timer expired (context: 0)
<debug> app_timer: Timer expired before scheduled to RTC.
<debug> app_timer: Activating timer (CC:6144/00001800).
<debug> app_timer: Timer expired (context: 0)
<debug> app_timer: Timer expired before scheduled to RTC.
<debug> app_timer: Activating timer (CC:7168/00001C00).
<debug> app_timer: Setting CC to 0x00001C00 (err: 0)
<info> app: here, err 0
<info> app: Init Display.
<debug> app_timer: Compare EVT
<debug> app_timer: Timer expired (context: 0)
<debug> app_timer: Activating timer (CC:8192/00002000).
<debug> app_timer: Setting CC to 0x00002000 (err: 0)
<debug> app_timer: Compare EVT
<debug> app_timer: Timer expired (context: 0)
<debug> app_timer: Activating timer (CC:9216/00002400).
<debug> app_timer: Setting CC to 0x00002400 (err: 0)
<debug> app_timer: Compare EVT
<debug> app_timer: Timer expired (context: 0)
<debug> app_timer: Activating timer (CC:10240/00002800).
<debug> app_timer: Setting CC to 0x00002800 (err: 0)
<info> GPIOTE: Function: nrfx_gpiote_init, error code: NRF_SUCCESS.
<info> GPIOTE: Function: nrfx_gpiote_in_init, error code: NRF_SUCCESS.
<info> GPIOTE: Function: nrfx_gpiote_in_init, error code: NRF_SUCCESS.
<info> GPIOTE: Function: nrfx_gpiote_in_init, error code: NRF_SUCCESS.
<info> GPIOTE: Function: nrfx_gpiote_in_init, error code: NRF_SUCCESS.
<debug> app_timer: Compare EVT
<debug> app_timer: Timer expired (context: 0)
<debug> app_timer: Activating timer (CC:11264/00002C00).
<debug> app_timer: Setting CC to 0x00002C00 (err: 0)
<debug> app_timer: Compare EVT
<debug> app_timer: Timer expired (context: 0)
<debug> app_timer: Activating timer (CC:12288/00003000).
<debug> app_timer: Setting CC to 0x00003000 (err: 0)
<debug> app_timer: Compare EVT
<debug> app_timer: Timer expired (context: 0)
<debug> app_timer: Activating timer (CC:13312/00003400).
<debug> app_timer: Setting CC to 0x00003400 (err: 0)
<debug> app_timer: Compare EVT
<debug> app_timer: Timer expired (context: 0)
<debug> app_timer: Activating timer (CC:14336/00003800).
<debug> app_timer: Setting CC to 0x00003800 (err: 0)
<info> app: Init S2LP.
<info> app: Init SPI.
<info> app: ManagmentRcoCalib.
<info> app: Done.
<debug> app: advertising is started

What am I doing wrong? What can I debug?

3286.FreeRTOSConfig.h6574.sdk_config.h

Related