Use UARTE0 on the nrf5340 network core

Hello,

I'm am trying to use the UART0 bus on the network core at the address: 

        uart0: uart@41013000 {
            compatible = "nordic,nrf-uarte";
            reg = <0x41013000 0x1000>;
            interrupts = <19 NRF_DEFAULT_IRQ_PRIORITY>;
            status = "disabled";
            label = "UART_0";
        };
Of course, I have disabled other drivers on the same address and I have configured the pins corresponding to my custom board in the overlay file of the cpunet:
&uart0 {
        status = "okay";
        current-speed = <115200>;
        tx-pin = <31>;
        rx-pin = <30>;
        rts-pin = <29>;
        cts-pin = <42>;
};
I measure the TX line to see if the bus is working correctly but the line is always at low state.
I also check the register state in debug mode and all seems to be ok:
I tried to access to the nrfx api directly, to release GPIO of the cpuapp and to remove all busses on the cpuapp, however, the bus is still not working.
To be sure the issue is not comming somewhere else, I also did a small firmware to test if the pins are working correctly with the cpuapp driver (of corse after removing it from the cpunet) and with the cpuapp the bus is working correctly, The TX is high by default and I can see the transmitted bits.
Is there any issue wih the SDK regarding the busses on the cpunet ? Or do you have any lead to fix my issue?
Thank you in advance,
David
Parents
  • Hi,

    Which SDK version are you using? The pins need to be forwarded to the network core, something which is very easy on v2.0.0 and newer, but slightly more complicated on older versions.

  • Hi,

    Thank you for the quick reply, I am using the lastest SDK version V2.0.2

  • Ok. Since v2.0.0 we started using pinctrl, so the way you should set up your overlay file is slightly different.
    If you are building your network core image as a child image, you need to create a folder named "child_image" in your project and place the overlay file for the network core there. It should have the name of the project running on the network core, for example hci_rpmsg.overlay

    The network core overlay file should look something like this:

    &pinctrl {
    	uart0_default_alt: uart0_default_alt {
    		group1 {
    			psels = <NRF_PSEL(UART_TX, 0, 31)>,
    				<NRF_PSEL(UART_RTS, 0, 29)>;
    		};
    		group2 {
    			psels = <NRF_PSEL(UART_RX, 0, 30)>,
    				<NRF_PSEL(UART_CTS, 1, 10)>;
    			bias-pull-up;
    		};
    	};
    
    	uart0_sleep_alt: uart0_sleep_alt {
    		group1 {
    			psels = <NRF_PSEL(UART_TX, 0, 31)>,
    				<NRF_PSEL(UART_RX, 0, 30)>,
    				<NRF_PSEL(UART_RTS, 0, 29)>,
    				<NRF_PSEL(UART_CTS, 1, 10)>;
    			low-power-enable;
    		};
    	};
    };
    
    &uart0 {
    	status = "okay";
    	current-speed = <115200>;
    	pinctrl-0 = <&uart0_default_alt>;
    	pinctrl-1 = <&uart0_sleep_alt>;
    	pinctrl-names = "default", "sleep";
    };

    You will also need an overlay file for the application core, placed in the project folder or a "boards" folder.
    This is to forward the required pins to the network core:

    &gpio_fwd {
    	compatible = "nordic,nrf-gpio-forwarder";
    	status = "okay";
    	uart {
    		gpios = <&gpio0 31 0>, <&gpio0 30 0>, <&gpio0 29 0>, <&gpio1 10 0>;
    	};
    };

Reply
  • Ok. Since v2.0.0 we started using pinctrl, so the way you should set up your overlay file is slightly different.
    If you are building your network core image as a child image, you need to create a folder named "child_image" in your project and place the overlay file for the network core there. It should have the name of the project running on the network core, for example hci_rpmsg.overlay

    The network core overlay file should look something like this:

    &pinctrl {
    	uart0_default_alt: uart0_default_alt {
    		group1 {
    			psels = <NRF_PSEL(UART_TX, 0, 31)>,
    				<NRF_PSEL(UART_RTS, 0, 29)>;
    		};
    		group2 {
    			psels = <NRF_PSEL(UART_RX, 0, 30)>,
    				<NRF_PSEL(UART_CTS, 1, 10)>;
    			bias-pull-up;
    		};
    	};
    
    	uart0_sleep_alt: uart0_sleep_alt {
    		group1 {
    			psels = <NRF_PSEL(UART_TX, 0, 31)>,
    				<NRF_PSEL(UART_RX, 0, 30)>,
    				<NRF_PSEL(UART_RTS, 0, 29)>,
    				<NRF_PSEL(UART_CTS, 1, 10)>;
    			low-power-enable;
    		};
    	};
    };
    
    &uart0 {
    	status = "okay";
    	current-speed = <115200>;
    	pinctrl-0 = <&uart0_default_alt>;
    	pinctrl-1 = <&uart0_sleep_alt>;
    	pinctrl-names = "default", "sleep";
    };

    You will also need an overlay file for the application core, placed in the project folder or a "boards" folder.
    This is to forward the required pins to the network core:

    &gpio_fwd {
    	compatible = "nordic,nrf-gpio-forwarder";
    	status = "okay";
    	uart {
    		gpios = <&gpio0 31 0>, <&gpio0 30 0>, <&gpio0 29 0>, <&gpio1 10 0>;
    	};
    };

Children
Related