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

How to configure default state of GPIO ouput

Working with NRF5 SDK 15.0.x, if I configure an GPIO as output, its initial state is low. I can set it high after configuration, but it is briefly low. Is there anyway to configure the initial state to be high/set before the pin is connected as ouput using the SDK?

Thanks

Parents
  • Unless I understand it incorrectly, if you need to be sure that it is high even before you have started your program adn/or do the configuration, I guess you would required a pull-up on the board?

  • It does have an external pullup, I am configuring the pin in an open drain configuration using NRF_GPIO_PIN_S0D1 as the drive type as follows"

        nrf_gpio_cfg(pin,
            NRF_GPIO_PIN_DIR_OUTPUT,
            NRF_GPIO_PIN_INPUT_DISCONNECT,
            NRF_GPIO_PIN_NOPULL,
            NRF_GPIO_PIN_S0D1,
            NRF_GPIO_PIN_NOSENSE);

    When this function is called, the pin is pulled low as the default state for the output pin is cleared. What I am looking for is a way for the value associated with the pin to be set to 1 (i.e. disconnected) at configuration time so that the pin is not pulled low.

Reply
  • It does have an external pullup, I am configuring the pin in an open drain configuration using NRF_GPIO_PIN_S0D1 as the drive type as follows"

        nrf_gpio_cfg(pin,
            NRF_GPIO_PIN_DIR_OUTPUT,
            NRF_GPIO_PIN_INPUT_DISCONNECT,
            NRF_GPIO_PIN_NOPULL,
            NRF_GPIO_PIN_S0D1,
            NRF_GPIO_PIN_NOSENSE);

    When this function is called, the pin is pulled low as the default state for the output pin is cleared. What I am looking for is a way for the value associated with the pin to be set to 1 (i.e. disconnected) at configuration time so that the pin is not pulled low.

Children
Related