No TX activity for uart1 configuration on modified echo_bot example with nRF Connect SDK v2.1.0

Hello,

I'm having trouble getting the echo_bot example running over uart1 using an nRF52840 DK with nRF Connect SDK v2.1.0. I've configured a device overlay to configure uart1, enabled the interrupt driven config for uart1 and modified main.c to use the uart1 device. The main changes I made were:

nrf52840dk_nrf52840.overlay - Added suggested config from the Using UART 1 section of the Zephyr nRF52840 DK docs to ./echo_bot/boards/

&pinctrl {
	uart1_default: uart1_default {
		group1 {
			psels = <NRF_PSEL(UART_TX, 0, 14)>,
								<NRF_PSEL(UART_RX, 0, 16)>;
		};
	};
	/* required if CONFIG_PM_DEVICE=y */
	uart1_sleep: uart1_sleep {
		group1 {
			psels = <NRF_PSEL(UART_TX, 0, 14)>,
								<NRF_PSEL(UART_RX, 0, 16)>;
			low-power-enable;
		};
	};
};

&uart1 {
	compatible = "nordic,nrf-uarte";
	current-speed = <115200>;
	status = "okay";
	pinctrl-0 = <&uart1_default>;
	pinctrl-1 = <&uart1_sleep>;
	pinctrl-names = "default", "sleep";
};

prj.conf - Added CONFIG_UART_1_INTERRUPT_DRIVEN=y

CONFIG_SERIAL=y
CONFIG_UART_INTERRUPT_DRIVEN=y

CONFIG_UART_1_INTERRUPT_DRIVEN=y

main.c - Modified example to use uart1 instead of uart0.

// static const struct device *uart_dev = DEVICE_DT_GET(DT_NODELABEL(uart0));
static const struct device *uart_dev = DEVICE_DT_GET(DT_NODELABEL(uart1));

I'm able to debug the code and it runs without crashing, but I see no data when scoping the configured output pin P0.14 configured in the overlay. It is always pulled high. Running the program with uart0 works and I can see the data on the scope on pin P0.06.

Here is the full example project with my modifications. I suspect I've got the overlay and/or config not quite right. I'd appreciate any insights into what the issue may be.

echo_bot_uart1_not_working.zip

— Jeremy

Parents
  • Hello,

    It looks like you are missing the second group for the default state in your overlay. Please try this:

    &pinctrl {
    	uart1_default: uart1_default {
    		group1 {
    			psels = <NRF_PSEL(UART_TX, 0, 14)>;
    		};
            group2 {
                psels = <NRF_PSEL(UART_RX, 0, 16)>;
            };
    
    	};
    	/* required if CONFIG_PM_DEVICE=y */
    	uart1_sleep: uart1_sleep {
    		group1 {
    			psels = <NRF_PSEL(UART_TX, 0, 14)>,
    					<NRF_PSEL(UART_RX, 0, 16)>;
    			low-power-enable;
    		};
    	};
    };

    You can also route 'zephyr_shell_uart'  to uart1 if you override "chosen" like this:

    / {
        chosen {
            zephyr,console = &uart1;
    		zephyr,shell-uart = &uart1;
        };
    };
    

    Hope this helps.

    Best regards,

    Vidar

  • That fixed the problem, thanks! This looks to be a bug in the documentation I pulled the example overlay from (here). What's the best way to get the docs fixed?

    What does group1 and group2 represent in the overlay; could you point me to the docs on the uart configs?

Reply Children
  • Thanks for making me aware of this issue and sorry for the confusion caused by it. I will follow up internally to get the docs fixed. This is clearly a documentation error as the suggested overlay does not match the configuration used in our board files which have 2 groups for UART as you can see here link.

    With the overlay given in the documentation, only group1 with the RX pin will be overridden. The TX pin in group2 will remain unchanged.

    Grouping is needed when you need to apply a specific property for some of the pins. Like for UART0 where we want to enable pull-up on UART RX and CTS, but not on the TX and RTS line.

Related