Changing modbus pins on nrf5340 dev kit

I am unable to change modbus pins on the nRF 5340 dev kit. The default is pins 1.00 and 1.01 which work fine with the example and also with further development. But when you set CONFIG_BLE the network core takes over that UART.

This is what the existing overlay has:

&arduino_serial {
    status = "okay";

    modbus0 {
        compatible = "zephyr,modbus-serial";
        status = "okay";
        de-gpios = <&arduino_header 15 GPIO_ACTIVE_LOW>;    /* D9 */
    };
};
The modbus module gets the device node from:
#define MODBUS_NODE DT_COMPAT_GET_ANY_STATUS_OKAY(zephyr_modbus_serial)
The node is retrieved from the dev kit device tree:
arduino_serial: &uart1 {
    compatible = "nordic,nrf-uarte";
    current-speed = <115200>;
    pinctrl-0 = <&uart1_default>;
    pinctrl-1 = <&uart1_sleep>;
    pinctrl-names = "default", "sleep";
};
And the pinctrl dtsi:
uart1_default: uart1_default {
        group1 {
            psels = <NRF_PSEL(UART_TX, 1, 1)>;
        };
        group2 {
            psels = <NRF_PSEL(UART_RX, 1, 0)>;
            bias-pull-up;
        };
    };

    uart1_sleep: uart1_sleep {
        group1 {
            psels = <NRF_PSEL(UART_TX, 1, 1)>,
                <NRF_PSEL(UART_RX, 1, 0)>;
            low-power-enable;
        };
    };
It all makes sense. But then when I try to change it I get nothing out of UART 2. 
I actually don't even see where the speed is changed from 115200 to 19200.
I've tried a couple of different methods but something simple that should work is in the overlay:
 / {
    model = "Nordic NRF5340 DK NRF5340 Application";
    compatible = "nordic,nrf5340-dk-nrf5340-cpuapp";

    aliases {
        modbus-alt = &uart2;
    };
};
&uart2 {
    status = "okay";
    current-speed = <115200>;
    pinctrl-0 = <&uart2_default>;
    pinctrl-1 = <&uart2_sleep>;
    pinctrl-names = "default", "sleep";
};

&pinctrl {
    uart2_default: uart2_default {
        group1 {
            psels = <NRF_PSEL(UART_TX, 1, 7)>;
        };
        group2 {
            psels = <NRF_PSEL(UART_RX, 1, 8)>;
            bias-pull-up;
        };
    };

    uart2_sleep: uart2_sleep {
        group1 {
            psels = <NRF_PSEL(UART_TX, 1, 7)>,
                <NRF_PSEL(UART_RX, 1, 8)>;
            low-power-enable;
        };
    };
};
And then get the node in the module with:
#define MODBUS_NODE DT_COMPAT_GET_ANY_STATUS_OKAY(zephyr_modbus_alt)
I have also tried several other pins thinking maybe the hardware of the dev kit was controlling the lines. I have also tried this method and used the same pins that work when using the Arduino_Serial overlay method and it stops working also. This makes me think there is something going on in the nRF Modbus driver that I am not familiar with. 
Parents Reply Children
Related