Hi,
I want to get interrupt on GPIO using gpiote module.
I searched for example but couldn't get it.
Can you guide me how to use gpiote in nRF9160 ?
Regards,
Smitesh Mali
Hi,
I want to get interrupt on GPIO using gpiote module.
I searched for example but couldn't get it.
Can you guide me how to use gpiote in nRF9160 ?
Regards,
Smitesh Mali
Hi Smitesh,
You can use the GPIOTE on the nrf9160 by the functions which are documented in zephyr.
You can for example look at the basic blinky sample in zephyr and use that as reference.
Hi Martin,
The blinky example and the zephyr documentation seems for configuring input/output mode of GPIO and toggling the GPIO state only.
I want an example which can configure a pin as gpiote to get interrupt when state of that pin changes. (Just like we are doing in SDK 15.2 for nRF52840 ).
I was trying to add "nrfx_gpiote.c" file to the "asset tracker" project by adding macros to the proj.conf file like below
CONFIG_GPIO=y
CONFIG_GPIO_NRFX=y
CONFIG_GPIO_NRF_P0=y
CONFIG_NRFX_GPIOTE=y
I also added below to the .overlay file
&gpiote {
status = "ok";
gpio-pin=<2>;
};
But "nrfx_gpiote.c" file was not added.
so can you help me to add that file ?
Proper example to get gpiote interrupt would be even better.
Regards,
Smitesh Mali
Hi Martin,
The blinky example and the zephyr documentation seems for configuring input/output mode of GPIO and toggling the GPIO state only.
I want an example which can configure a pin as gpiote to get interrupt when state of that pin changes. (Just like we are doing in SDK 15.2 for nRF52840 ).
I was trying to add "nrfx_gpiote.c" file to the "asset tracker" project by adding macros to the proj.conf file like below
CONFIG_GPIO=y
CONFIG_GPIO_NRFX=y
CONFIG_GPIO_NRF_P0=y
CONFIG_NRFX_GPIOTE=y
I also added below to the .overlay file
&gpiote {
status = "ok";
gpio-pin=<2>;
};
But "nrfx_gpiote.c" file was not added.
so can you help me to add that file ?
Proper example to get gpiote interrupt would be even better.
Regards,
Smitesh Mali
Hi Martin,
I was able to configure interrupt on gpio using API provided in "gpio.h"
My code is below.
struct device *gpio_int1;
struct gpio_callback gpio_cb;
gpio_int1 = device_get_binding(DT_GPIO_P0_DEV_NAME);
gpio_pin_configure(gpio_int1, INT1_PIN, (GPIO_DIR_IN | GPIO_INT | GPIO_INT_EDGE | GPIO_PUD_PULL_DOWN | GPIO_INT_ACTIVE_HIGH ) );
gpio_init_callback(&gpio_cb, gpiote1_interrupt, BIT(INT1_PIN));
gpio_add_callback(gpio_int1,&gpio_cb);
error = gpio_pin_enable_callback(gpio_int1,INT1_PIN);
Regards,
Smitesh Mali