I have a custom board with 5 buttons, and a status LED, using the nrf52832_xxaa chip. 2 of the 5 buttons never trigger an interrupt. It seems like this is because nrf_gpio_pin_read always returns 0 for those 2 pins.
The pins are below:
constexpr uint32_t kButton0 = 15; constexpr uint32_t kButton1 = 12; constexpr uint32_t kButton2 = 7; constexpr uint32_t kButton3 = 9; constexpr uint32_t kResetButton = 10; constexpr uint32_t kStatusLed = 14
constexpr nrf_drv_gpiote_in_config_t kGpioteConfig = { sense : NRF_GPIOTE_POLARITY_HITOLO, pull : NRF_GPIO_PIN_NOPULL, is_watcher : false, hi_accuracy : true, }; void ButtonsInit() { APP_ERROR_CHECK(nrf_drv_gpiote_init()); APP_ERROR_CHECK( nrf_drv_gpiote_in_init(kButton0, &kGpioteConfig, &Button0Interrupt)); APP_ERROR_CHECK( nrf_drv_gpiote_in_init(kButton1, &kGpioteConfig, &Button1Interrupt)); APP_ERROR_CHECK( nrf_drv_gpiote_in_init(kButton2, &kGpioteConfig, &Button2Interrupt)); APP_ERROR_CHECK( nrf_drv_gpiote_in_init(kButton3, &kGpioteConfig, &Button3Interrupt)); APP_ERROR_CHECK(nrf_drv_gpiote_in_init(kResetButton, &kGpioteConfig, &ResetButtonInterrupt)); nrf_drv_gpiote_in_event_enable(kButton0, true); nrf_drv_gpiote_in_event_enable(kButton1, true); nrf_drv_gpiote_in_event_enable(kButton2, true); nrf_drv_gpiote_in_event_enable(kButton3, true); nrf_drv_gpiote_in_event_enable(kResetButton, true); nrf_gpio_cfg_output(kStatusLed); }
// Read PIN_CNF sstl::vector<uint32_t, 10> buttons = {kButton0, kButton1, kButton2, kButton3, kResetButton}; for (const auto& b : buttons) { LOG_I("PIN_CNF[%d]=%d", b, NRF_GPIO->PIN_CNF[b]); } // Output is... 00> <info> app: PIN_CNF[15]=0 00> <info> app: PIN_CNF[12]=0 00> <info> app: PIN_CNF[7]=0 00> <info> app: PIN_CNF[9]=0 00> <info> app: PIN_CNF[10]=0