gpio_api.c does not initialize the skip_gpio_setup flag so sometimes the setup is skipped. gpio_api.c ought to always explicitly set skip_gpio_setup to false.
nrfx_gpiote_in_config_t is the struct with the skip_gpio_setup field.
All usages of nrfx_gpiote_in_config_t and nrfx_gpiote_in_init() should be reviewed for correct initialization of skip_gpio_setup. There are several other defines meant to be used with nrfx_gpiote_in_init() that are also missing initialization of this field.
Including:
NRFX_GPIOTE_CONFIG_IN_SENSE_LOTOHI
NRFX_GPIOTE_CONFIG_IN_SENSE_HITOLO
NRFX_GPIOTE_CONFIG_IN_SENSE_TOGGLE
So I see a total of 4 bugs here:
1 in gpio.api.c and 3 in nrfx_gpiote.h
targets\TARGET_NORDIC\TARGET_NRF5x\TARGET_NRF52\gpio_api.c
targets\TARGET_NORDIC\TARGET_NRF5x\TARGET_SDK_15_0\modules\nrfx\drivers\include\nrfx_gpiote.h
Nordic NRF52840 and likely other Nordic MCU devices
GCC_ARM
b6e5a0a8afa34dec9dae8963778aebce0c82a54b
mbed-cli 1.10.1
Use an InterruptIn with a PullUp. You'll see that sometimes the PullUp does not get configured because skip_gpio_setup gets randomly assigned to true sometimes (based on stack contents).
@thendrickson Can you send a pull request with a fix?
cc @desmond-blue
@ARMmbed/team-embeddedplanet
This could potentially be causing a lot of frustration for people trying to reduce power consumption for these parts...
Thank you for raising this detailed GitHub issue. I am now notifying our internal issue triagers.
Internal Jira reference: https://jira.arm.com/browse/IOTOSM-2325
Is this still valid?
@AGlass0fMilk
Most helpful comment
This could potentially be causing a lot of frustration for people trying to reduce power consumption for these parts...