This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

GPIOTE handler triggered for all registered GPIO's, when only one of them changes state

Hello, i have six buttons on my custom board, these buttons are inited with following code:

(there are pull up resistors present, hence NRF_GPIO_PIN_NOPULL is used)

SEGGER_RTT_printf(0, "buttons init.\n");

err_code = nrf_drv_gpiote_init();
APP_ERROR_CHECK(err_code);

nrf_drv_gpiote_in_config_t in_config = GPIOTE_CONFIG_IN_SENSE_HITOLO(false);
in_config.pull = NRF_GPIO_PIN_NOPULL;

err_code = nrf_drv_gpiote_in_init(PIN_BTN1, &in_config, button_handler);
err_code = nrf_drv_gpiote_in_init(PIN_BTN2, &in_config, button_handler);
err_code = nrf_drv_gpiote_in_init(PIN_BTN3, &in_config, button_handler);
err_code = nrf_drv_gpiote_in_init(PIN_BTN4, &in_config, button_handler);
err_code = nrf_drv_gpiote_in_init(PIN_BTN5, &in_config, button_handler);
err_code = nrf_drv_gpiote_in_init(PIN_BTN6, &in_config, button_handler);

APP_ERROR_CHECK(err_code);

nrf_drv_gpiote_in_event_enable(PIN_BTN1, true);
nrf_drv_gpiote_in_event_enable(PIN_BTN2, true);
nrf_drv_gpiote_in_event_enable(PIN_BTN3, true);
nrf_drv_gpiote_in_event_enable(PIN_BTN4, true);
nrf_drv_gpiote_in_event_enable(PIN_BTN5, true);
nrf_drv_gpiote_in_event_enable(PIN_BTN6, true);

Problem is, that if i press any button when system is freshly booted and ready, after previous NVIC_SystemReset() , button_handler is triggered for all of the buttons at the same time.

My button_handler routine prints a debug message when it's triggered by button press, and if i press any of six buttons (when system is freshly booted), i get six subsequent messages for all of the buttons (all GPIO lines registered for GPIOTE IN events):

button_handler triggered: 10.
button_handler triggered: 15.
button_handler triggered: 17.
button_handler triggered: 36.
button_handler triggered: 9.
button_handler triggered: 38.

This looks like a hardware issue, but it happens only once, after system is booted. Then, after this first button press, all buttons work normally, without issues (one button press - one GPIOTE IN event triggered). Again, once, after reboot, when any of six buttons present on board is pressed - six GPIOTE events are triggered for all GPIO lines used for buttons. Then buttons work as expected.

All GPIO's have separate pull up resistors, nothing is common hardware wise.

 

Parents
  • Another thing to add: i have noticed that described behavior happens only when system is waked up from NRF_POWER->SYSTEMOFF = 1; by button press - GPIO event. System is in SYSTEMOFF state, any button is pressed, system is restarting, application is ready, and then, first button press triggers button_handler for all of registered GPIOs.

Reply
  • Another thing to add: i have noticed that described behavior happens only when system is waked up from NRF_POWER->SYSTEMOFF = 1; by button press - GPIO event. System is in SYSTEMOFF state, any button is pressed, system is restarting, application is ready, and then, first button press triggers button_handler for all of registered GPIOs.

Children
No Data
Related