Change UART pins dynamically

Hello

Is is possible to change the UART pins dynamically?
I am thinking to predefine the pins on device tree as follows:

&uart1 {
    status = "okay";
    current-speed = <115200>;
    pinctrl-0 = <&uart1_default>;
    pinctrl-1 = <&uart1_sleep>;
    pinctrl-3 = <&uart1_3_default>;
    pinctrl-4 = <&uart1_4_sleep>;
 
};
and then choose between different pinctrl on runtime.
Is this something possible? Is there any other way to achieve that functionality?
Thank you
  • Hi

    Currently there is no official way of doing it Zephyr. There a PR in progress that I would suspect might be ready for the next release for NCS(3.1) which is due to come out later this year. 

    A colleague of mine made a workaround for this  which can find here I would note the sample was made for NCS 2.5.x so it might not work out of the box for a newer version of NCS

    Regards

    Runar

Related