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

never call "app_button_is_pushed()" function in ble-lbs-master project

Hello Nordic,

I am trying debugging on following project [--ble_app_lbs_master--]. During debugging, I never reach at app_button_is_pushed function. I tried pressing the button while debugging and in connected state.

Actually I want to read the button_pin_status (value) in between when button pressed and button detected. How can I do that?

Please suggest valuable suggestions.

Thanks n Regards

Update1: @Aryan: Please find the attached app_button.x file.app_button.c

Update2: @Aryan:

image description

uint32_t app_button_init(app_button_cfg_t * p_buttons, uint8_t button_count, uint32_t detection_delay) image description

Parents
  • There was a PAN that on OUTINIT on some hardware IC rev and the workaround for it was removed from SDK from 8.0.0.

    in SDK9.0 and SDK 8.1, nrf_gpiote.h nrf_gpiote_task_configure needs a fix for the above to work. update it with this code and let me know if it works.

    __STATIC_INLINE void nrf_gpiote_task_configure(uint32_t idx, uint32_t pin,
                                                    nrf_gpiote_polarity_t polarity,
                                                    nrf_gpiote_outinit_t  init_val)
    {
        /* Check if the output desired is high or low */
        if (init_val == NRF_GPIOTE_INITIAL_VALUE_LOW)
        {
            /* Workaround for the OUTINIT PAN. When nrf_gpiote_task_config() is called a glitch happens
            on the GPIO if the GPIO in question is already assigned to GPIOTE and the pin is in the 
            correct state in GPIOTE but not in the OUT register. */
            NRF_GPIO->OUTCLR = (1 << pin);
    
            /* Configure channel to Pin31, not connected to the pin, and configure as a tasks that will set it to proper level */
            NRF_GPIOTE->CONFIG[idx] = (GPIOTE_CONFIG_MODE_Task       << GPIOTE_CONFIG_MODE_Pos)     |
                                                 (31UL                          << GPIOTE_CONFIG_PSEL_Pos)     |
                                                 (GPIOTE_CONFIG_POLARITY_HiToLo << GPIOTE_CONFIG_POLARITY_Pos);                                    
        } 
        else 
        {
            /* Workaround for the OUTINIT PAN. When nrf_gpiote_task_config() is called a glitch happens
            on the GPIO if the GPIO in question is already assigned to GPIOTE and the pin is in the 
            correct state in GPIOTE but not in the OUT register. */
            NRF_GPIO->OUTSET = (1 << pin);
    
            /* Configure channel to Pin31, not connected to the pin, and configure as a tasks that will set it to proper level */
            NRF_GPIOTE->CONFIG[idx] = (GPIOTE_CONFIG_MODE_Task       << GPIOTE_CONFIG_MODE_Pos)     |
                                                 (31UL                          << GPIOTE_CONFIG_PSEL_Pos)     |
                                                 (GPIOTE_CONFIG_POLARITY_LoToHi << GPIOTE_CONFIG_POLARITY_Pos);
        }
    
        /* Three NOPs are required to make sure configuration is written before setting tasks or getting events */
        __NOP();
        __NOP();
        __NOP(); 
    
        /* Launch the task to take the GPIOTE channel output to the desired level */
        NRF_GPIOTE->TASKS_OUT[idx] = 1;
    
    
        /* Finally configure the channel as the caller expects. If OUTINIT works, the channel is configured properly. 
           If it does not, the channel output inheritance sets the proper level. */
        NRF_GPIOTE->CONFIG[idx] = (GPIOTE_CONFIG_MODE_Task << GPIOTE_CONFIG_MODE_Pos)     |
                                             ((uint32_t)pin    << GPIOTE_CONFIG_PSEL_Pos)     |
                                             ((uint32_t)polarity      << GPIOTE_CONFIG_POLARITY_Pos) |
                                             ((uint32_t)init_val << GPIOTE_CONFIG_OUTINIT_Pos);
    
        /* Three NOPs are required to make sure configuration is written before setting tasks or getting events */
        __NOP();
        __NOP();
        __NOP(); 
    }
    
  • Hello @Aryan,

    I tried the same. It doesn't stop at the --app_button_is_pushed-- function, even with and without button press.

    It always comes at [// Pushed button(s) detected, execute button handler(s)] here.

    Please suggest.

Reply Children
No Data
Related