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

GPIO pin configuration

Hi there!

We are using nRF52840DK development kit with nRF-Connect SDK to build a pre-production version of our product.
We need more GPIO configurations for our project. Can we get step by step procedure for GPIO configuration other than predefined GPIO(led1, led2, button1, etc.) names.
It is really critical for us to come up with a solution for this ASAP.
Thanks for the support in advance!
Regards,
Samuel kapa
Parents Reply
  • hi Amanda H,

          here is the sample code i am writing for gpio.

    #include <zephyr.h>
    #include <device.h>
    #include <sys/util.h>
    #include <inttypes.h>
    #include <devicetree.h>
    #include <sys/printk.h>
    #include <drivers/pwm.h>
    #include <drivers/gpio.h>
    #include <nrfx/hal/nrf_gpio.h>


    //#define SLEEP_TIME_MS 3000

    #define OUTPUT_PIN 15


    void main(void)
    {
        nrf_gpio_cfg_output(OUTPUT_PIN);
       

        while (1) {
                       nrf_gpio_pin_set(OUTPUT_PIN);
                      k_sleep(K_SECONDS(3U));
                      nrf_gpio_pin_clear(OUTPUT_PIN);
                      k_sleep(K_SECONDS(3U));
                  }
    }

    with is pin number 15 or 16, 13, 14. i am getting output.

    but if i change the pin number to like 1 or 2. i am not getting any out put but it's uploading to board.

    thanks,

    samuel kapa.

Children
Related