NRF9160 DK using P0.14 pin as Output

Hi All,

Hope you are doing well.

I am using NRF Connect SDK 1.5.0 with NRF9160 DK. I want to use P0.14 (Arduino Header Pin) as output for the RESET of LR1110 (SPI Device).

Till now, I am unable to run even a blinky for P0.14.

I have changed the nrf9160dk_nrf52840.overlay with the below configurations

/ {
	model = "Nordic nRF9160 DK NRF52840";
	compatible = "nordic,nrf9160-dk-nrf52840";

	board-control {
		vcom2_pins_routing: switch-nrf91-uart2 {
			compatible = "nordic,nrf9160dk-optional-routing";
			/*
			 * Two pins (P1.12 and P0.12) need to be driven for
			 * this switch.
			 */
			control-gpios = <&gpio1 12 GPIO_ACTIVE_LOW>,
					<&gpio0 12 GPIO_ACTIVE_LOW>;
			status = "disabled";
		};
	};
};

In my code for nrf9160dk_nrf9160ns, I have made changes in nrf9160dk_nrf9160ns.overlay as below

&uart1 {
	status = "disabled";
};

Below is my main code for just making the P0.14 toggle.

#include <zephyr.h>
#include <device.h>
#include <logging/log.h>
#include <drivers/gpio.h>

#define LR_RESET_PIN 14

const struct device *dev_gpio;
#define GPIO0_LABEL DT_PROP(DT_NODELABEL(gpio0), label)
#define GPIO0_STATUS DT_PROP(DT_NODELABEL(gpio0), status)

void main(void) {
    int retErr;
	
	retErr = gpio_pin_configure(dev_gpio, LR_RESET_PIN, GPIO_OUTPUT_ACTIVE);
	if(retErr != 0) {
		printk("GPIO Reset config err.\n");
		return;
	}
	
	while() {
	    gpio_pin_set(dev_gpio, LR_RESET_PIN, (int)0);
	    k_sleep(K_MSEC(10));
	    gpio_pin_set(dev_gpio, LR_RESET_PIN, (int)1);
	    k_sleep(K_MSEC(10));
	}
}

If I change LR_RESET_PIN to "7", I can see the P0.7 toggling, if I change it to "15", P0.15 is not toggling like P0.14.

Please tell me what I am doing wrong.

Thanks in advance.

Parents
  • I have managed to get P0.14 working as Ouput.

    Below are the hacks.

    Flash "hello_world" sample in NRF52840 with below nrf9160dk_nrf52840.overlay

    vcom2_pins_routing: switch-nrf91-uart2 {
    		compatible = "nordic,nrf9160dk-optional-routing";
    		/*
    		 * Two pins (P1.12 and P0.12) need to be driven for
    		 * this switch.
    		 */
    		control-gpios = <&gpio1 0 GPIO_ACTIVE_HIGH>,
    				<&gpio0 0 GPIO_ACTIVE_HIGH>;
    		status = "okay";
    	};

    gpio1 0 & gpio0 0 can be any unused PIns you can think of for NRF52840

    And use your main code for NRF9160 with nrf9160dk_nrf9160ns.overlay

    &uart1 {
    	status = "okay";
    	current-speed = <115200>;
    	tx-pin = <1>;
    	rx-pin = <0>;
    	rts-pin = <32>;
    	cts-pin = <15>;
    };

    P0.32 can be any unused Pin.

    After getting above things right, I am able to toggle P0.14 Pin for my RESET control.

Reply
  • I have managed to get P0.14 working as Ouput.

    Below are the hacks.

    Flash "hello_world" sample in NRF52840 with below nrf9160dk_nrf52840.overlay

    vcom2_pins_routing: switch-nrf91-uart2 {
    		compatible = "nordic,nrf9160dk-optional-routing";
    		/*
    		 * Two pins (P1.12 and P0.12) need to be driven for
    		 * this switch.
    		 */
    		control-gpios = <&gpio1 0 GPIO_ACTIVE_HIGH>,
    				<&gpio0 0 GPIO_ACTIVE_HIGH>;
    		status = "okay";
    	};

    gpio1 0 & gpio0 0 can be any unused PIns you can think of for NRF52840

    And use your main code for NRF9160 with nrf9160dk_nrf9160ns.overlay

    &uart1 {
    	status = "okay";
    	current-speed = <115200>;
    	tx-pin = <1>;
    	rx-pin = <0>;
    	rts-pin = <32>;
    	cts-pin = <15>;
    };

    P0.32 can be any unused Pin.

    After getting above things right, I am able to toggle P0.14 Pin for my RESET control.

Children
No Data
Related