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

Multiple button interrupts: NRF_BREAKPOINT_COND

Hello

I am trying to read a multiplexed button matrix, using the BSP button interrupt example. I am doing this on a custom made PCB with an NRF52840 on-board. This is my code in the gpio_init() function:

 //configure inputs
    nrf_drv_gpiote_in_config_t in_config = GPIOTE_CONFIG_IN_SENSE_LOTOHI(false);
    in_config.pull = NRF_GPIO_PIN_NOPULL;

    err_code = nrf_drv_gpiote_in_init(BTNROW1_PIN, &in_config, BUTTON_PIN_handler);
    APP_ERROR_CHECK(err_code);
    err_code = nrf_drv_gpiote_in_init(BTNROW2_PIN, &in_config, BUTTON_PIN_handler);
    APP_ERROR_CHECK(err_code);
    err_code = nrf_drv_gpiote_in_init(BTNROW3_PIN, &in_config, BUTTON_PIN_handler);
    APP_ERROR_CHECK(err_code);
    err_code = nrf_drv_gpiote_in_init(BTNROW4_PIN, &in_config, BUTTON_PIN_handler);
    APP_ERROR_CHECK(err_code);
    err_code = nrf_drv_gpiote_in_init(BTNROW5_PIN, &in_config, BUTTON_PIN_handler);
    APP_ERROR_CHECK(err_code);
    err_code = nrf_drv_gpiote_in_init(BTNROW6_PIN, &in_config, BUTTON_PIN_handler);
    APP_ERROR_CHECK(err_code);

    //enable interrupt on input level change
    nrf_drv_gpiote_in_event_enable(BTNROW1_PIN, true);
    nrf_drv_gpiote_in_event_enable(BTNROW2_PIN, true);
    nrf_drv_gpiote_in_event_enable(BTNROW3_PIN, true);
    nrf_drv_gpiote_in_event_enable(BTNROW4_PIN, true);
    nrf_drv_gpiote_in_event_enable(BTNROW5_PIN, true);
    nrf_drv_gpiote_in_event_enable(BTNROW6_PIN, true);

When using only one button in the code, it works perfectly. However, as soon as I use the code above and go into debug mode, I get stuck on NRF_BREAKPOINT_COND. I have seen this error popping up with UART, but it is not yet configured. What might be the cause of this?

Parents
  • Hi,

    One of the function calls probably report an error code and puts your in the error handler. Please debug the application, for instance following this video tutorial if you are using SES, to see which function returns the error, and what the error code is. 

    One initial idea is that you have not modified the GPIOTE driver config that set how many pins can be used as low power inputs (GPIOTE PORT event) in sdk_config.h:

    // <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 1
    #endif

    Best regards,
    Jørgen

Reply
  • Hi,

    One of the function calls probably report an error code and puts your in the error handler. Please debug the application, for instance following this video tutorial if you are using SES, to see which function returns the error, and what the error code is. 

    One initial idea is that you have not modified the GPIOTE driver config that set how many pins can be used as low power inputs (GPIOTE PORT event) in sdk_config.h:

    // <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 1
    #endif

    Best regards,
    Jørgen

Children
Related