This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Pin pull configuration using app_gpiote_user_register

I'm attempting to make a sense of app_gpiote.c (in SDK 11) to see if it's suitable for my application and I can't find a match between the documentation, the sample code and the actual code in the library. I want to use it to handle toggle events coming from a pin that needs to be configured as NRF_GPIO_PIN_PULLUP. The documentation on app_gpiote clearly states that the burden of the port configuration is on the user with the exception of the sense configuration which is recommended to be set at disabled. The sample code on GitHub ( github.com/.../nrf51_app_gpiote_example ) does configure the port before calling app_gpiote_user_register (even if in the case of the example the sense is configured as low). Still if one looks at what app_gpiote_user_register works in app_gpiote.c, there is clearly const nrf_drv_gpiote_in_config_t config = GPIOTE_CONFIG_IN_SENSE_TOGGLE(false); for the pins of interest which, clearly again resolves in a configuration that is forced to NRF_GPIO_PIN_NOPULL.

I don't want to base my code on this just to discover that it doesn't work. Has anybody experience with this? If it works, how does it work?

Parents
  • The documentation of app_gpiote states The GPIOTE users are responsible for configuring all their corresponding pins, except the SENSE field, which should be initialized to GPIO_PIN_CNF_SENSE_Disabled. If I look at how app_gpiote.c is implemented (SDK 11 in my case) app_gpiote_user_register initializes the pins using nrf_drv_gpiote_in_init passing a config structure intialized by GPIOTE_CONFIG_IN_SENSE_TOGGLE(false) which is defined as #define GPIOTE_CONFIG_IN_SENSE_TOGGLE(hi_accu)
    {
    .is_watcher = false,
    .hi_accuracy = hi_accu,
    .pull = NRF_GPIO_PIN_NOPULL,
    .sense = NRF_GPIOTE_POLARITY_TOGGLE,
    }
    which seems to me that the pin configuration will be overridden to NOPULL anyway. This doesn't seem to match with the docs.

Reply
  • The documentation of app_gpiote states The GPIOTE users are responsible for configuring all their corresponding pins, except the SENSE field, which should be initialized to GPIO_PIN_CNF_SENSE_Disabled. If I look at how app_gpiote.c is implemented (SDK 11 in my case) app_gpiote_user_register initializes the pins using nrf_drv_gpiote_in_init passing a config structure intialized by GPIOTE_CONFIG_IN_SENSE_TOGGLE(false) which is defined as #define GPIOTE_CONFIG_IN_SENSE_TOGGLE(hi_accu)
    {
    .is_watcher = false,
    .hi_accuracy = hi_accu,
    .pull = NRF_GPIO_PIN_NOPULL,
    .sense = NRF_GPIOTE_POLARITY_TOGGLE,
    }
    which seems to me that the pin configuration will be overridden to NOPULL anyway. This doesn't seem to match with the docs.

Children
No Data
Related