NRF9160 DK UART configuration

Hi

I am currently running and adjusting the zephyr echo_bot uart sample
on my nrf9160 DK. Currently , the sample makes use of UART0 to send a receive information which I have made compatible with an external device and the nrf terminal. My issue is that configuring the exact code to UART1 or UART0 has been difficult to achieve. Please assist.

Parents
  • Hello Hasssan Khan,

    Thank you for contacting DevZone at NordicSemi.

    Your query is regarding configuring and using a different uart on a nrf9160DK.

    You can use overlay file to configure the device-tree properly for your needs.

    For example, as in this case, you want to use uart1 to communicate to the computer for printing / echoing-back. You can choose your uart port for console output using following in the device overlay.

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

    Also, by default, uart1 would be disabled, so you need to enable it, and set the required baudrate using code like:

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

    Please connect with the configured baudrate on your serial terminaal or nrf terminal.
    You need to connect to the correct COM port on your computer.

    This is all I could infer from your query. If you need more specific help, please do send more information including code, log, and/or overlay files etc.

    Thank you and regards,
    Naeem

Reply
  • Hello Hasssan Khan,

    Thank you for contacting DevZone at NordicSemi.

    Your query is regarding configuring and using a different uart on a nrf9160DK.

    You can use overlay file to configure the device-tree properly for your needs.

    For example, as in this case, you want to use uart1 to communicate to the computer for printing / echoing-back. You can choose your uart port for console output using following in the device overlay.

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

    Also, by default, uart1 would be disabled, so you need to enable it, and set the required baudrate using code like:

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

    Please connect with the configured baudrate on your serial terminaal or nrf terminal.
    You need to connect to the correct COM port on your computer.

    This is all I could infer from your query. If you need more specific help, please do send more information including code, log, and/or overlay files etc.

    Thank you and regards,
    Naeem

Children
No Data
Related