Cannot use UART1

Hello, I cannot use UART1, and I don`t know the reason for that.
I run the exercise: https://academy.nordicsemi.com/courses/nrf-connect-sdk-fundamentals/lessons/lesson-4-serial-communication-uart/topic/exercise-1-5/

using UART0, and it works fine. When I replaced UART0 with UART1, I could not receive or transmit any data.
The overlay, the prj.conf, and the output in case UART1 are attached.

I am using NCS version 2.9.0

This is the output in case UART1 and the LEDs didn`t toggle.

This is the prj.conf file:

Here is the overlay file:

Parents
  • Look at the generated dts in build/zephyr - UART1 has none of the pinctrl stuff IIRC. You also need to disable all conflicting shared peripherials (TWI/SPI) in the dts overlay.

  • 1145.devicetree_generated.h

    Here is the generated device tree file. Could you please tell me the lines of pinctrl that exist for uart0, not uart1?

    I thought uart1 assigned pinctrl as the nrf52840dk_nrf52840.dts file contains this configuration for uart1

    arduino_serial: &uart1 {
        current-speed = <115200>;
        pinctrl-0 = <&uart1_default>;
        pinctrl-1 = <&uart1_sleep>;
        pinctrl-names = "default", "sleep";
    };
    and the nrf52840dk_nrf52840-pinctrl.dtsi contains this configuration for uart1_default and uart1_sleep
    uart1_default: uart1_default {
            group1 {
                psels = <NRF_PSEL(UART_RX, 1, 1)>;
                bias-pull-up;
            };
            group2 {
                psels = <NRF_PSEL(UART_TX, 1, 2)>;
            };
        };

        uart1_sleep: uart1_sleep {
            group1 {
                psels = <NRF_PSEL(UART_RX, 1, 1)>,
                    <NRF_PSEL(UART_TX, 1, 2)>;
                low-power-enable;
            };
        };
  • Hi,

    UART0 is defined on lines 7-27 in nrf52840dk_nrf52840-pinctrl.dtsi:

    uart0_default: uart0_default {
    	group1 {
    		psels = <NRF_PSEL(UART_TX, 0, 6)>,
    			<NRF_PSEL(UART_RTS, 0, 5)>;
    	};
    	group2 {
    		psels = <NRF_PSEL(UART_RX, 0, 8)>,
    			<NRF_PSEL(UART_CTS, 0, 7)>;
    		bias-pull-up;
    	};
    };
    
    uart0_sleep: uart0_sleep {
    	group1 {
    		psels = <NRF_PSEL(UART_TX, 0, 6)>,
    			<NRF_PSEL(UART_RX, 0, 8)>,
    			<NRF_PSEL(UART_RTS, 0, 5)>,
    			<NRF_PSEL(UART_CTS, 0, 7)>;
    		low-power-enable;
    	};
    };

    While UART1 is defined on lines 21-45 of the same file:

    uart1_default: uart1_default {
    	group1 {
    		psels = <NRF_PSEL(UART_RX, 1, 1)>;
    		bias-pull-up;
    	};
    	group2 {
    		psels = <NRF_PSEL(UART_TX, 1, 2)>;
    	};
    };
    
    uart1_sleep: uart1_sleep {
    	group1 {
    		psels = <NRF_PSEL(UART_RX, 1, 1)>,
    			<NRF_PSEL(UART_TX, 1, 2)>;
    		low-power-enable;
    	};
    };

    Best regards,
    Marte

  • Thank you for your response.
    Is there anything in the definition of the uart1 that prevents it from working?

Reply Children
Related