Why am I receiving data through /dev/ttyACM1 while transmitting over pin 8 (UART1 TX) on nRF9151?


Hi, I'm working with the nRF9151DK and Zephyr RTOS (v3.7.99 / NCS 2.9.1). I’ve configured UART1 to send and receive data via GPIO pins:

  • TX: pin 8 (P0.08)

  • RX: pin 9 (P0.09)

devicetree.overlay:

/ {
    chosen {
        zephyr,console = &uart1;
    };
};

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

&pinctrl {
    uart1_default: uart1_default {
        group1 {
            psels = <NRF_PSEL(UART_TX, 0, 8)>,
                    <NRF_PSEL(UART_RX, 0, 9)>;
        };
    };

    uart1_sleep: uart1_sleep {
        group1 {
            psels = <NRF_PSEL(UART_TX, 0, 8)>,
                    <NRF_PSEL(UART_RX, 0, 9)>;
            low-power-enable;
        };
    };
};

prj.conf:

CONFIG_SERIAL=y
CONFIG_UART_CONSOLE=n
CONFIG_USB_DEVICE_STACK=n
CONFIG_PRINTK=y

main.c:

#include <zephyr/device.h>
#include <zephyr/devicetree.h>
#include <zephyr/drivers/uart.h>
#include <zephyr/kernel.h>

#define UART_NODE DT_NODELABEL(uart1)

void main(void) {
    const struct device *uart_dev = DEVICE_DT_GET(UART_NODE);

    if (!device_is_ready(uart_dev)) {
        return;
    }

    uint8_t ch;
    int ret;

    while (1) {
        uart_poll_out(uart_dev, 'H');
        uart_poll_out(uart_dev, 'i');
        uart_poll_out(uart_dev, '\n');

        ret = uart_poll_in(uart_dev, &ch);
        if (ret == 0) {
            uart_poll_out(uart_dev, ch); // Simple echo
            uart_poll_out(uart_dev, '\n');
        }

        k_sleep(K_MSEC(1000));
    }
}

 Current Behavior:

  • Data is transmitted correctly through pin 8 (UART1 TX) using an external USB-to-Serial adapter.

  • But data is only received via /dev/ttyACM1, which seems to correspond to the USB interface (UART0?).

Question:

Why does Zephyr still receive input through /dev/ttyACM1 even though UART0 is disabled and UART1 is enabled and routed to GPIO pins?

Am I missing a configuration step to fully detach the USB UART console and use only physical UART1 (pins 8/9) for both TX and RX?

Thank you in advance for your help! Pray

Related