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

GPIO voltage output

I am using the nRF51822 bluetooth low energy smart beacon kit and am running into trouble using the GPIOs available on the board (pins 0, 1, 2, 3, 5, 9, 11, 20, 21, 24). For the purpose of this post, let's assume I only need to use one of them, i.e. pin 5.

  1. How do I use the GPIO to output the 3 V coin cell battery voltage I am using to power the board? What needs to be set and to what values?

  2. Do the high and low settings output the same voltage, but just allow for different levels of current?

  3. I saw on another answered question that said it is not recommended to use the LDO to power any external circuitry. Is it even possible to access these regulated voltages (really I just want to use the 1.2 V from the LDO for part of an external circuit) from the GPIO? If so, why is it not recommended to use the LDO for powering an external circuit and what current draw to the external circuit might be acceptable?

Thank you in advance.

  • I think the data sheet says maximum current draw for the gpiote module is 15mA. Wouldn't recommend to power anything external with that. You could drive a transistor instead for such things.

  • Hi

    To simply configure a GPIO pin as an output and set it high or low you can e.g. do this:

    // Configure pin 5 as output
    nrf_gpio_cfg_output(5);
    // Set pin 5 high
    nrf_gpio_pin_set(5);
    // Set pin 5 low
    nrf_gpio_pin_clear(5);
    

    If you set the pin high its voltage will be VDD, if you set it low the voltage will be 0. You can configure each GPIO pin in high drive or standard drive. In standard drive you can source/sink 0.5mA. In high drive the pin can source/sink 5mA. You can source/sink a total of 15mA. So for example 3 x 5 mA, 5 x 3 mA, etc.

    It is absolutely not recommended to use the LDO to power anything external. The LDOs are used to power internal circuits such as the radio, the CPU, and the flash. If you use them to power anything else you might induce voltage ripples, surges, etc. that can affect the circuits. The reason why the LDO's output voltage is even routed to a pin is so that you can add an external decoupling capacitor. If you connect anything to the LDOs you do so at your own discretion.

Related