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

nrf9160 GPIO pull-up/pull-down for driving external circuitry

Hello,

anyone with with knowledge on how to control the gpio pins of the NRF 9160 SiP?

In my scenario, I am using P0.01 - P0.12 as digital control signals, for "Enableing" external circuitry.

I've come over code, which I've been playing around with, without any progress.

void main(void)
{
   int cnt = 0;
   struct device *dev;

   dev = device_get_binding("GPIO_0");
   /* Set LED pin as output */
   gpio_pin_configure(dev, 9, GPIO_DIR_OUT); //p0.03 == LED2
   gpio_pin_configure(dev, 10, GPIO_DIR_OUT); //p0.04 == LED3
   gpio_pin_configure(dev, 11, GPIO_DIR_OUT); //p0.17

   while (1) {
      /* Set pin to HIGH/LOW every 1 second */
      gpio_pin_write(dev, 9, cnt % 2); //p0.03 == LED2
      gpio_pin_write(dev, 10, cnt % 2); //p0.04 == LED3
      gpio_pin_write(dev, 11, cnt % 2); //p0.17 Toggling pin 17
      cnt++;
      k_sleep(SLEEP_TIME);
   }
}

Also, I have enabled in prj.conf file:

CONFIG_GPIO=y

----------------

What am I doing wrong?

I would like to use these pins as pull-down/pull-ups.

With regards, David

Related