Hi,
I was wondering if I could get a little information on how to set a pin as High Impedance using the zephyr gpio.h library.
We have a shared pin between a nRF9160 and a nRF52832 for an on-board sensor interrupt pin that has been misbehaving on some devices but is resolved by setting the nRF9160's GPIO to high impedance.
I see that the library includes:
/** Disconnect pin when GPIO pin output is low. * For hardware that does not support disconnect use the default * drive strength. */ #define GPIO_DS_DISCONNECT_LOW (0x3 << GPIO_DS_LOW_POS) /** Disconnect pin when GPIO pin output is high. * For hardware that does not support disconnect use the default * drive strength. */ #define GPIO_DS_DISCONNECT_HIGH (0x3 << GPIO_DS_HIGH_POS)
Do both of these options need to be set as flags when configuring the GPIO for this pin?
Something like this:
/* When configured in */ gpio_pin_configure(Int1, INT1_PIN, (GPIO_DIR_IN | GPIO_INT | GPIO_INT_EDGE | GPIO_INT_ACTIVE_HIGH | GPIO_PUD_PULL_DOWN )); /* When set to high impedance */ gpio_pin_configure(Int1, INT1_PIN, (GPIO_DIR_IN | GPIO_DS_DISCONNECT_HIGH | GPIO_DS_DISCONNECT_LOW ));
Currently I am using the direct method to set the pin as high impedance on the nRF91 but would prefer to keep using the same format to configure my system:
nrf_gpio_cfg( INT2_PIN, NRF_GPIO_PIN_DIR_INPUT, NRF_GPIO_PIN_INPUT_DISCONNECT, NRF_GPIO_PIN_NOPULL, NRF_GPIO_PIN_S0S1, NRF_GPIO_PIN_NOSENSE );