How to link nrfx_gpiote and GPIO1 port on Zephyr?

Hi guys. 

I'm using the development board NFR52840DK and I modified the sample in zephyr\samples\boards\nrf\nrfx to use twp buttons, sw0 and sw1. 

The sw0 button reset a counter when interruption occours and sw1 increments the counter. 

I tried this using two DK buttons and eveything worked fine.

The problem occours when I try to configure an enternal button using GPOI1 and pin 3 (P1.3). The code don't work like before. Only sw0 works fine, but sw1 don't.

Using an osciloscope I observed that the pull up on P1.3 wasn't hign and looks like the pin wasn't configured properly. 

When I use P0.2 like an external button the code works again.

Then my doubt is how configure GPIO1 with nrfx? What's I'm missing? 

The configuration code is 

void gpiote_config_pins(void)
{
	nrfx_err_t err;

	nrfx_gpiote_in_config_t const in_config = {
		.sense = NRF_GPIOTE_POLARITY_HITOLO,
		.pull = NRF_GPIO_PIN_PULLUP,
		.is_watcher = false,
		.hi_accuracy = true,
		.skip_gpio_setup = false,
	};

	/* Initialize input pin to generate event on high to low transition
	 * (falling edge) and call button_handler()
	 */
	
	err = nrfx_gpiote_in_init(INPUT_PIN, &in_config, button_handler);
	if (err != NRFX_SUCCESS) {
		LOG_ERR("nrfx_gpiote_in_init error: %08x", err);
		return;
	}

	err = nrfx_gpiote_in_init(INPUT_PIN1, &in_config, button_handler);
	if (err != NRFX_SUCCESS) {
		LOG_ERR("input1 nrfx_gpiote_in_init error: %08x", err);
		return;
	}

	nrfx_gpiote_in_event_enable(INPUT_PIN, true); //once per time
	nrfx_gpiote_in_event_enable(INPUT_PIN1, true); //once per time
}

and the nrf52840dk_nrf52840.overlay is 

&button1 {
	gpios = <&gpio1 03 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
};

Someone can help me with this? 
Thanks.

Related