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

Reply
  • 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

Children
Related