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

nRF9160DK Use Pins P0.00, P0.01, P0.14, P0.15

Hello,

This question is related to https://devzone.nordicsemi.com/f/nordic-q-a/44150/taking-adc-readings-from-p0-14-and-p0-15/173235#173235. I am using nRF9160DK board.

I am trying to use all those pins P0.00, P0.01, P0.14, P0.15 either for SPI or chip select.

However, it does not seem to work and seems to clash with the UAR as explained in https://infocenter.nordicsemi.com/index.jsp?topic=%2Fug_nrf91_dk%2FUG%2Fnrf91_DK%2Fif_connector.html"

P0.00, P0.01, P0.14, and P0.15 Used as a second UART connection to the interface MCU. For more information, see Virtual COM port.

How can I use those pins ? It seems that they are driven from the nrf52 on the board through the pin P1.12. By default according to https://infocenter.nordicsemi.com/index.jsp?topic=%2Fug_nrf91_dk%2FUG%2Fnrf91_DK%2Fif_connector.html, they should be available but it does not seems to be.

  • Hi,

    While the default configuration in the hardware is that those pins are routed to the headers, the default behavior of the board controller firmware is to rout them to the VCOM (these pins are used for taking modem traces).

    When you build an NCS project for the nrf9160dk_nrf52840 board, the "board controller" functionality gets added automatically. And on startup, it will set the "control pins" based on a set of Kconfig options. You can see the Kconfig options for the nrf9160dk_nrf52840 board here: https://github.com/nrfconnect/sdk-zephyr/blob/master/boards/arm/nrf9160dk_nrf52840/Kconfig

    You can read more about how the board controller works here: https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.3.0/zephyr/boards/arm/nrf9160dk_nrf52840/doc/index.html#board-controller-firmware

    So, to change the board controller behavior, you can use any NCS project (that does not use the GPIO pins). I usually use Zephyr's hello_world sample. You can then add the Kconfig options you want to the prj.conf file, and flash the resulting hex file to the board controller (remember to set SW5 to the correct position).

    In your case, you want to set CONFIG_BOADR_NRF9160DK_UART1_ARDUINO=y.

    Best regards,

    Didrik

  • Hello,

    I think we have the same issue. We cannot control P0.00 as a simple GPIO.

    We are currently working with the following environment:

    • NCS 2.3.0
    • NRF9160
    • Application copied from Asset Tracker V2

    We have created a new board, taking as a reference the following issue: https://devzone.nordicsemi.com/f/nordic-q-a/91260/devicetree-error-ipc-ipc0-undefined-node-label-sram0_shared

    Therefore, we have copied the folder: C:\ncs\v2.3.0\zephyr\boards\arm\nrf9160dk_nrf9160 and renamed the boards to our custom name.

    The deviceTree looks as follows:

    &gpio0 {
    	status = "okay";
    	label = "GPIO_0";
    };
    
    &uart0 {
    	current-speed = <115200>;
    	status = "okay";
    	pinctrl-0 = <&uart0_default>;
    	pinctrl-1 = <&uart0_sleep>;
    	pinctrl-names = "default", "sleep";
    };
    
    &uart1 {
    	current-speed = <115200>;
    	status = "okay";
    	pinctrl-0 = <&uart1_default>;
    	pinctrl-1 = <&uart1_sleep>;
    	pinctrl-names = "default", "sleep";
    };
    
    &pinctrl {
    	uart0_default: uart0_default {
    		group1 {
        	psels = <NRF_PSEL(UART_TX, 0, 6)>;
        };
        group2 {
        	psels = <NRF_PSEL(UART_RX, 0, 7)>;
        };
      };
    	uart0_sleep: uart0_sleep {
    		group1 {
    			psels = <NRF_PSEL(UART_TX, 0, 6)>;
    			low-power-enable;
    		};
    		group2 {
    			psels = <NRF_PSEL(UART_RX, 0, 7)>;
    		};
    	};
    
      uart1_default {
    	group1 {
    		psels = <NRF_PSEL(UART_TX, 0, 13)>;
    	};	
    	group2 {
    		psels = <NRF_PSEL(UART_RX, 0, 14)>;
    	};
    	};
    
    	uart1_sleep {
    		group1 {
    			psels = <NRF_PSEL(UART_TX, 0, 13)>,
    				<NRF_PSEL(UART_RX, 0, 14)>;
    			low-power-enable;
    		};
    	};
    };

    Moreover, we have redefined UART1, which it is the UART which uses P0.00 in the evaluation board.

    Meanwhile the code:

      const struct device *const gpio0_group = device_get_binding("GPIO_0");
    
      if (!gpio0_group) {
        printk("Could not get GPIO 0 device\n");
        return;
      }
    
      if (!device_is_ready(gpio0_group)) {
        printk("GPIO 0 device not ready.\n");
        return;
      }
    
      int ret = gpio_pin_configure(gpio0_group, 0, GPIO_OUTPUT);
      if (ret) {
        printk("Set GPIO0 0 pin failed (%d)", ret);
        return;
      }
      gpio_pin_set(gpio0_group, 0, 1);

    We are able to change the output of other PIN, 5, for instance. But not this one.

    How do we should approach this issue?

    We cannot start from a hello world example....

    Regards

Related