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

Gpio driver current sink capability setup

Hi,

Please, what are the settings for gpio driver in sdk15.2. for some gpio pin to be able to sink current (to act as gnd? ). In my project it is used for loadswitch enable pin, so I have to configure some gpio to be able to be high - supplying current, or low - sinking current. 

Thanks,

Pepam

  • Hi,

    You can configure the GPIO and set the the drive level using the function nrf_gpio_cfg()

    For high drive for both sinking and sourcing, use NRF_GPIO_PIN_H0H1

    Snippet:

            nrf_gpio_cfg(PIN_NUMBER,
                     NRF_GPIO_PIN_DIR_OUTPUT,
                     NRF_GPIO_PIN_INPUT_DISCONNECT,
                     NRF_GPIO_PIN_NOPULL,
                     NRF_GPIO_PIN_H0H1,
                     NRF_GPIO_PIN_NOSENSE);
    
                     nrf_gpio_pin_write(PIN_NUMBER,0); // Set low
                     nrf_gpio_pin_write(PIN_NUMBER,1); // Set high

Related