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

GPIO interrupt after wake up

Hello

My custom board has only 1 button and I'm trying to detect 3 button clicks. The first click is waking up the device and the other 2 are configured as BSP_EVENT_KEY_0.  I noticed people pushes the button between 0.2s to 0.4s after each click and the nRF52832 is not detecting the second click and the button has to be pressed a 4th time.

The IRQ prority is already at 2. I´m not sure if I should put it higher. My guess is that something in the main has higher priority and it is ignoring the bsp event

The only problem i have is when the device is sleeping. When the device is advertising the interruptions work fine. Any idea what is happening?

Here is my main, 

 

int main(void)
 {
    bool       wakeup;

    ret_code_t err_code;

    log_init();

    // Initialize the async SVCI interface to bootloader before any interrupts are enabled.
    err_code = ble_dfu_buttonless_async_svci_init();
    APP_ERROR_CHECK(err_code);

    timers_init();
    buttons_leds_init(&wakeup);
    my_fstorage_init();
    if(wakeup)
    {
        timer_counter();
    }
    power_management_init();
    fstorage_read(0x66C00,4);
    
    ble_stack_init();
    peer_manager_init();
    gap_params_init();
    gatt_init();
    services_init(); 
    conn_params_init();
    advertising_init();
    
    //saadc init
    saadc_init();
    saadc_sampling_event_init();
    saadc_sampling_event_enable();
    
    adv_init_and_start();

    NRF_LOG_INFO("GWi DFU Application started.");
    // Enter main loop.
    for (;;)
    {
        idle_state_handle();
    }
}

SDK15.2

nrf52832 custom board

nrf52DK

windows 10

segger v4.16

Parents
  • The BSP uses the app_button library who has implemented SW debouncing by setting an app_timer to trigger a callback after 50ms where the app_button library will check to see if the button is still pressed. 
    If the pin event is triggered before the 50ms has expired the app_button library will reset the app_timer. This might cause you trouble if the button signal is extremely bouncy. 

    I would scope the button signal to check for noise issues and log the button press patterns of good vs bad operations. This will give us valuable insight into how the application responds to the button presses. 

  • Sorry for the late reply, 

    It doesnt seem to be the problem because once the device is awake I can press the button as fast as i can and it detects every single click. The issue is just the first half second after waking up.

  • Hmm, my best guess is that something is blocking the CPU from executing. Maybe the starting of the LFXO as it can take a few hundred ms. 

    Do you mind sharing a project that we can use to recreate your issue? 
    I suggest you strip out seemingly unrelated part of your code until the issue disappears as that will help us narrow down where the issue originates. 

  • Hello, 
    I posted the code as private. Evn tho i don´t think it is necessary for you to check it. I think i found the problem. After doing some changes I left the main with the following fucntions:

    log_init();
    timers_init();
    buttons_leds_init(&wakeup);
    ble_stack_init();

    After doing some research i found out the issue is the nrf_sdh_enable_request takes too long executing. Sadly the guy didnt post how he solved it. Do you have any idea what is going on?

Reply
  • Hello, 
    I posted the code as private. Evn tho i don´t think it is necessary for you to check it. I think i found the problem. After doing some changes I left the main with the following fucntions:

    log_init();
    timers_init();
    buttons_leds_init(&wakeup);
    ble_stack_init();

    After doing some research i found out the issue is the nrf_sdh_enable_request takes too long executing. Sadly the guy didnt post how he solved it. Do you have any idea what is going on?

Children
Related