uart0 overlay for hello_world app

I've got a custom board based on the nRF52810 SoC. I want to use GPIO P0.06 for UART_TX and P0.08 for UART_RX. I used the new board wizard in nRF Connect to create a new board based on the nrf52810 and added the following overlay code:

&uart0 {
    status = "okay";
    compatible = "nordic,nrf-uart";
    tx-pin = < 6 >;
    rx-pin = < 8 >;
    current-speed = < 115200 >;
    parity = "none";
    rts-pin = < 0xffffffff >;
    cts-pin = < 0xffffffff >;
};

The app builds and appears to run (I can step in the debuger), but I'm not seeing the "Hello World" text output on GPIO pin P0.06.

I'm guessing I need to add some more stuff to my overlay file. What am I missing?

Project folder attached here.

7360.hello_world.zip

Parents
  • I'm continuing to research this issue. In the file C:\ncs\v2.2.0\zephyr\dts\bindings\serial\nordic,nrf-uart-common.yaml\nordic,nrf-uart-common.yaml I find that the terms tx-pin and rx-pin are deprecated if the "pin control driver" is not used. But I'm pretty sure I want to use pin control, since it's the way things are supported in the future. So I started researching the driver here:

    https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.0.0/nrf/ug_pinctrl.html#ug-pinctrl

    So I think the example I need is how to do an overlay file that uses pin control to re-map the UART pins with the nRF52 DK board.

    Using the above guide, this is what my revised overlay file looks like, but it still doesn't work:

    &pinctrl {
        uart0_default: uart0_default {
            group1 {
                psels = <NRF_PSEL(UART_TX, 0, 6)>;
            };
            group2 {
                psels = <NRF_PSEL(UART_RX, 1, 8)>;
                bias-pull-up;
            };
        };
    };
    &uart0 {
        pinctrl-0 = <&uart0_default>;
        pinctrl-names = "default";
    };
    

    Is there an example somewhere of how to do this for a UART?

  • So I did something similar to you using pinctrl with an nRF52833 board and an app.overlay, for uart1

    &pinctrl {
    	uart1_default: uart1_default {
    	   group1 {
    		  psels = <NRF_PSEL(UART_TX, 1, 2)>,
    				  <NRF_PSEL(UART_RX, 1, 1)>;
    	   };
    	};
    	/* required if CONFIG_PM_DEVICE=y */
    	uart1_sleep: uart1_sleep {
    	   group1 {
    		  psels = <NRF_PSEL(UART_TX, 1, 2)>,
    				  <NRF_PSEL(UART_RX, 1, 1)>;
    		  low-power-enable;
    	   };
    	};
     };
    
     &uart1 {
       compatible = "nordic,nrf-uarte";
       current-speed = <19200>;
       status = "okay";
       pinctrl-0 = <&uart1_default>;
       pinctrl-1 = <&uart1_sleep>;
       pinctrl-names = "default", "sleep";
     };
    

    This did work for me. i'd double check to make sure your project is using the overlay.

  • I got it to work as well. I changed the code for my nRF52832, which has just one UART:

    &pinctrl {
    	uart0_default: uart0_default {
    	   group1 {
    		  psels = <NRF_PSEL(UART_TX, 0, 11)>,
    				  <NRF_PSEL(UART_RX, 0, 13)>;
    	   };
    	};
    	/* required if CONFIG_PM_DEVICE=y */
    	uart0_sleep: uart0_sleep {
    	   group1 {
    		  psels = <NRF_PSEL(UART_TX, 0, 11)>,
    				  <NRF_PSEL(UART_RX, 0, 13)>;
    		  low-power-enable;
    	   };
    	};
     };
    
     &uart0{
    
       compatible = "nordic,nrf-uarte";
       current-speed = <115200>;
       status = "okay";
       pinctrl-0 = <&uart0_default>;
       pinctrl-1 = <&uart0_sleep>;
       pinctrl-names = "default", "sleep";
     };

  • I tried the same overlay file with my 52810 and it didn't work (no TX data seen). The board I have the 52810 SoC on has TX on pin 6 and RX on pin 8. I suspect the issue here is that there does not exist a DK board for the 52810 so nobody at Nordic has tried the UART overlay. But somebody at Nordic probably has a custom board on which they can try a Zephyr build with this overlay.

    &pinctrl {
    	uart0_default: uart0_default {
    	   group1 {
    		  psels = <NRF_PSEL(UART_TX, 0, 6)>,
    				  <NRF_PSEL(UART_RX, 0, 8)>;
    	   };
    	};
    	/* required if CONFIG_PM_DEVICE=y */
    	uart0_sleep: uart0_sleep {
    	   group1 {
    		  psels = <NRF_PSEL(UART_TX, 0, 6)>,
    				  <NRF_PSEL(UART_RX, 0, 8)>;
    		  low-power-enable;
    	   };
    	};
     };
    
     &uart0{
    
       compatible = "nordic,nrf-uarte";
       current-speed = <19200>;
       status = "okay";
       pinctrl-0 = <&uart0_default>;
       pinctrl-1 = <&uart0_sleep>;
       pinctrl-names = "default", "sleep";
     };
    

    Here's the dts file that the "create a new board" wizard gave me:

    // Copyright (c) 2023 Nordic Semiconductor ASA
    // SPDX-License-Identifier: Apache-2.0
    
    /dts-v1/;
    #include <nordic/nrf52810_qfaa.dtsi>
    
    / {
    	model = "nrf52810_cm";
    	compatible = "nrf52810-cm";
    
    	chosen {
    		zephyr,sram = &sram0;
    		zephyr,flash = &flash0;
    		zephyr,code-partition = &slot0_partition;
    	};
    };
    
    &flash0 {
    	partitions {
    		compatible = "fixed-partitions";
    		#address-cells = <1>;
    		#size-cells = <1>;
    
    		boot_partition: partition@0 {
    			label = "mcuboot";
    			reg = <0x0 0xc000>;
    		};
    		slot0_partition: partition@c000 {
    			label = "image-0";
    			reg = <0xc000 0xa000>;
    		};
    		slot1_partition: partition@16000 {
    			label = "image-1";
    			reg = <0x16000 0xa000>;
    		};
    		scratch_partition: partition@20000 {
    			label = "image-scratch";
    			reg = <0x20000 0xa000>;
    		};
    		storage_partition: partition@2a000 {
    			label = "storage";
    			reg = <0x2a000 0x6000>;
    		};
    	};
    };
    
    

    Here's the uart0 binding in the nrf52810.dtsi file:

    		uart0: uart@40002000 {
    			/* uart can be either UART or UARTE, for the user to pick */
    			/* compatible = "nordic,nrf-uarte" or "nordic,nrf-uart"; */
    			compatible = "nordic,nrf-uarte";
    			reg = <0x40002000 0x1000>;
    			interrupts = <2 NRF_DEFAULT_IRQ_PRIORITY>;
    			status = "disabled";
    		};

Reply
  • I tried the same overlay file with my 52810 and it didn't work (no TX data seen). The board I have the 52810 SoC on has TX on pin 6 and RX on pin 8. I suspect the issue here is that there does not exist a DK board for the 52810 so nobody at Nordic has tried the UART overlay. But somebody at Nordic probably has a custom board on which they can try a Zephyr build with this overlay.

    &pinctrl {
    	uart0_default: uart0_default {
    	   group1 {
    		  psels = <NRF_PSEL(UART_TX, 0, 6)>,
    				  <NRF_PSEL(UART_RX, 0, 8)>;
    	   };
    	};
    	/* required if CONFIG_PM_DEVICE=y */
    	uart0_sleep: uart0_sleep {
    	   group1 {
    		  psels = <NRF_PSEL(UART_TX, 0, 6)>,
    				  <NRF_PSEL(UART_RX, 0, 8)>;
    		  low-power-enable;
    	   };
    	};
     };
    
     &uart0{
    
       compatible = "nordic,nrf-uarte";
       current-speed = <19200>;
       status = "okay";
       pinctrl-0 = <&uart0_default>;
       pinctrl-1 = <&uart0_sleep>;
       pinctrl-names = "default", "sleep";
     };
    

    Here's the dts file that the "create a new board" wizard gave me:

    // Copyright (c) 2023 Nordic Semiconductor ASA
    // SPDX-License-Identifier: Apache-2.0
    
    /dts-v1/;
    #include <nordic/nrf52810_qfaa.dtsi>
    
    / {
    	model = "nrf52810_cm";
    	compatible = "nrf52810-cm";
    
    	chosen {
    		zephyr,sram = &sram0;
    		zephyr,flash = &flash0;
    		zephyr,code-partition = &slot0_partition;
    	};
    };
    
    &flash0 {
    	partitions {
    		compatible = "fixed-partitions";
    		#address-cells = <1>;
    		#size-cells = <1>;
    
    		boot_partition: partition@0 {
    			label = "mcuboot";
    			reg = <0x0 0xc000>;
    		};
    		slot0_partition: partition@c000 {
    			label = "image-0";
    			reg = <0xc000 0xa000>;
    		};
    		slot1_partition: partition@16000 {
    			label = "image-1";
    			reg = <0x16000 0xa000>;
    		};
    		scratch_partition: partition@20000 {
    			label = "image-scratch";
    			reg = <0x20000 0xa000>;
    		};
    		storage_partition: partition@2a000 {
    			label = "storage";
    			reg = <0x2a000 0x6000>;
    		};
    	};
    };
    
    

    Here's the uart0 binding in the nrf52810.dtsi file:

    		uart0: uart@40002000 {
    			/* uart can be either UART or UARTE, for the user to pick */
    			/* compatible = "nordic,nrf-uarte" or "nordic,nrf-uart"; */
    			compatible = "nordic,nrf-uarte";
    			reg = <0x40002000 0x1000>;
    			interrupts = <2 NRF_DEFAULT_IRQ_PRIORITY>;
    			status = "disabled";
    		};

Children
No Data
Related