Hi,
I'm using ncs 2.9.0.
I configured the GPIO in device tree like this:
usb { compatible = "gpio-keys"; usb0: usb_0 { gpios = <&gpio1 2 (GPIO_PULL_DOWN | GPIO_ACTIVE_HIGH)>; label = "usb power"; }; }; aliases { ... usb0 = &usb0; };
static const struct gpio_dt_spec usb_spec = GPIO_DT_SPEC_GET(DT_ALIAS(usb0), gpios); static struct gpio_callback usb_gpio_cb_data; void init_charge_gpios(void) { ret = gpio_pin_configure_dt(&usb_spec, GPIO_INPUT); if (ret != 0) { LOG_WRN("Error %d: failed to configure %s pin %d\n", ret, usb_spec.port->name, usb_spec.pin); return; } gpio_init_callback(&charging_gpio_cb_data, usb_gpio_triggered, BIT(usb_spec.pin)); gpio_add_callback(usb_spec.port, &charging_gpio_cb_data); LOG_WRN("%s gpio_pin_interrupt_configure_dt usb_spec start", __func__); ret = gpio_pin_interrupt_configure_dt(&usb_spec, GPIO_INT_TRIG_BOTH); if (ret != 0) { LOG_WRN("Error %d: failed to configure interrupt on %s pin %d\n", ret, usb_spec.port->name, usb_spec.pin); return; } }
[00:50:48.702,264] <wrn> BATTERY: init_charge_gpios gpio_pin_interrupt_configure_dt usb_spec start
[00:50:48.702,339] <err> os: r0/a1: 0x00000004 r1/a2: 0x00000377 r2/a3: 0x000a91ae
[00:50:48.702,348] <err> os: r3/a4: 0x00000004 r12/ip: 0x00000000 r14/lr: 0x00020f55
[00:50:48.702,355] <err> os: xpsr: 0x01100000
[00:50:48.702,365] <err> os: s[ 0]: 0x20025688 s[ 1]: 0x20025688 s[ 2]: 0x00000000 s[ 3]: 0x00000000
[00:50:48.702,374] <err> os: s[ 4]: 0x00000000 s[ 5]: 0x00021bc1 s[ 6]: 0x00000000 s[ 7]: 0x20025674
[00:50:48.702,384] <err> os: s[ 8]: 0x20025622 s[ 9]: 0x0007d2b5 s[10]: 0x000a91ae s[11]: 0x20025674
[00:50:48.702,393] <err> os: s[12]: 0x20025622 s[13]: 0x00020f4b s[14]: 0x000a91ae s[15]: 0x00000000
[00:50:48.702,400] <err> os: fpscr: 0x20025622
[00:50:48.702,405] <err> os: Faulting instruction address (r15/pc): 0x0007d2a2
[00:50:48.702,423] <err> os: >>> ZEPHYR FATAL ERROR 4: Kernel panic on CPU 0
[00:50:48.702,440] <err> os: Current thread: 0x20005b08 (unknown)
[00:50:49.599,430] <err> os: Halting system
Is there anything wrong with my configuration?
Thanks in advance!