Hi there,
I'm using an nRF52840 pin to monitor GPIO state transitions, but it keeps reporting frequent phantom low transitions without high transitions in between. According to my Saleae Logic 4 analyzer, the pin is always low.
Devicetree fragment:
/ { gpios { compatible = "gpio-keys"; charger_stat: charger_stat { gpios = <&gpio0 22 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>; label = "charger_stat"; }; } }
Code fragment:
const struct gpio_dt_spec chargerStatDt = GPIO_DT_SPEC_GET(DT_ALIAS(charger_stat), gpios); void chargerStatCallback(const struct device *port, struct gpio_callback *cb, gpio_port_pins_t pins) { if (Shell.statLog) { printk("STAT changed to %i\n", gpio_pin_get_dt(&chargerStatDt) ? 1 : 0); } } gpio_pin_configure_dt(&chargerStatDt, GPIO_INPUT); gpio_pin_interrupt_configure_dt(&chargerStatDt, GPIO_INT_EDGE_BOTH); gpio_init_callback(&callbackStruct, chargerStatCallback, BIT(chargerStatDt.pin)); gpio_add_callback(chargerStatDt.port, &callbackStruct);
Thanks in advance for your help!
- Laci