How to enable both physical uart0 and ble nus service uart

Hi, I'm using nrf52810 ,nrf connect, zephyr, vscode extension. I’m having trouble using both UART0 and the NUS UART service.  Here’s a snippet from my overlay file:

/ {
    chosen {
        nordic,nus-uart = &uart0;
    };
};
&uart0 {
    compatible = "nordic,nrf-uarte";
    current-speed = <115200>;
    status = "okay";
    pinctrl-0 = <&uart0_default>;
    pinctrl-1 = <&uart0_sleep>;
    pinctrl-names = "default", "sleep";
};

I previously tested this code on an NRF52840, which has two physical UARTs (UART0 and UART1), where NUS used UART0 and the physical UART was set to UART1.

How can I bind the NUS UART service to something other than UART0? When both are on the same UART peripheral, the code doesn’t work.

Is it possible to create a "dummy UART1" in the DTS file since the NUS service doesn’t use a hardware UART peripheral?

br

Teijo
Parents
  • Hi Teijo,

    The problem is that nRF52810 has only one hardware UART and it's not possible to use the UART peripheral together for multiple stuff. 

    You suggestion of using a dummy UART (say, uart1) for the NUS in the dts file could help (though I have not tried it here). You could maybe set it's status as disabled in the dts so that it does not attempt to assign a physical pin to it. I see that you have tried this and you get errors. Could you share your overlay file?

    Another idea would be to maybe try time-sharing the UART0 and NUS.

    Regards,

    Priyanka

Reply
  • Hi Teijo,

    The problem is that nRF52810 has only one hardware UART and it's not possible to use the UART peripheral together for multiple stuff. 

    You suggestion of using a dummy UART (say, uart1) for the NUS in the dts file could help (though I have not tried it here). You could maybe set it's status as disabled in the dts so that it does not attempt to assign a physical pin to it. I see that you have tried this and you get errors. Could you share your overlay file?

    Another idea would be to maybe try time-sharing the UART0 and NUS.

    Regards,

    Priyanka

Children
No Data
Related