Hi all,
I'm working on a custom board based on the nRF9160 and using nRF Connect SDK v3.0.2. We’ve developed the board in-house and integrated the npm1300 PMIC as part of our power management solution.
Everything is working well overall, but I’m facing an issue with GPIO buttons. Specifically:
- I use the first two GPIOs from the npm1300 as buttons.
- I also have five other buttons directly connected to GPIOs on the nRF9160, and those work fine.
- I use GPIO 0.26 from the nRF9160 as host-int-gpio property
However, when I declare the two npm1300-based buttons in the devicetree, I get this error during application startup:
[00:00:00.382,568] <err> gpio_keys: Could not set gpio callback [00:00:00.382,598] <err> gpio_keys: Pin 5 interrupt configuration failed: -88
Here is the relevant devicetree snippet for the npm1300:
npm1300_pmic: npm1300@6b { compatible = "nordic,npm1300"; reg = <0x6b>; pmic-int-pin = <4>; host-int-gpios = <&gpio0 26 GPIO_ACTIVE_HIGH>; ship-to-active-time-ms = <1008>; long-press-reset = "one-button"; status = "okay"; npm1300_gpio: npm1300_gpio { compatible = "nordic,npm1300-gpio"; status = "okay"; gpio-controller; #gpio-cells = <2>; ngpios = <5>; }; npm1300_regulators: regulators { compatible = "nordic,npm1300-regulator"; status = "okay"; npm1300_buck1: BUCK1 { status = "disabled"; }; regulator_3v0: BUCK2 { regulator-min-microvolt = <3000000>; regulator-max-microvolt = <3000000>; regulator-init-microvolt = <3000000>; regulator-boot-on; regulator-always-on; }; // LDO1 regulator_display: LDO1 { regulator-initial-mode = <NPM1300_LDSW_MODE_LDSW>; regulator-boot-on; status = "okay"; }; // LDO2 is not used npm1300_ldo2: LDO2 { status = "disabled"; }; }; npm1300_charger: charger { compatible = "nordic,npm1300-charger"; term-microvolt = <4200000>; term-warm-microvolt = <4000000>; current-microamp = <400000>; term-current-percent = <10>; dischg-limit-microamp = <1000000>; vbus-limit-microamp = <500000>; thermistor-ohms = <10000>; thermistor-beta = <3435>; //3380 charging-enable; }; npm1300_leds: leds { compatible = "nordic,npm1300-led"; nordic,led0-mode = "charging"; nordic,led1-mode = "host"; nordic,led2-mode = "host"; }; npm1300_buttons: buttons { compatible = "gpio-keys"; status = "okay"; }; };
And here is the devicetree definition for the buttons : buttons: buttons {
compatible = "gpio-keys";
debounce-interval-ms = <100>;
button0: button_0 {
label = "bt0-enter";
gpios = <&gpio0 0 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
zephyr,code = <INPUT_KEY_ENTER>;
};
button1: button_1 {
label = "bt1-up";
gpios = <&gpio0 1 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
zephyr,code = <INPUT_KEY_UP>;
};
button2: button_2 {
label = "bt2-left";
gpios = <&gpio0 2 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
zephyr,code = <INPUT_KEY_LEFT>;
};
button3: button_3 {
label = "bt3-down";
gpios = <&gpio0 3 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
zephyr,code = <INPUT_KEY_DOWN>;
};
button4: button_4 {
label = "bt4-right";
gpios = <&gpio0 4 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
zephyr,code = <INPUT_KEY_RIGHT>;
};
button5: button_5 {
label = "bt5";
gpios = <&npm1300_gpio 0 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
zephyr,code = <INPUT_KEY_1>;
};
button6: button_6 {
label = "bt6";
gpios = <&npm1300_gpio 1 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
zephyr,code = <INPUT_KEY_2>;
};
};
I'm really not sure what’s going wrong here. Has anyone encountered something similar when using npm1300 GPIOs as input buttons? Any ideas or pointers would be greatly appreciated!
Thanks in advance!