UART configuration for nRF5340DK (controller) and nRF5340 Audio DK (host)

Hi All,

I flashed an nRF5340 DK board with a samples/bluetooth/hci_uart image and one more nRF5340 Audio DK with a samples/bluetooth/peripheral image.

I have not made any DTS changes for the nRF5340 DK board (using it as a controller). Below are the changes made in the nRF5340 Audio DK DTS file,

chosen {
		zephyr,bt-uart = &uart3;
};

&uart3 {
	status = "okay";
	current-speed = <115200>;
	pinctrl-0 = <&uart3_default>;
	pinctrl-1 = <&uart3_sleep>;
	pinctrl-names = "default", "sleep";
};

uart3_default: uart3_default {
	group1 {
		psels = <NRF_PSEL(UART_TX, 1, 12)>,
		<NRF_PSEL(UART_RTS, 1, 11)>;
	};
	group2 {
		psels = <NRF_PSEL(UART_RX, 1, 13)>,
		<NRF_PSEL(UART_CTS, 1, 1)>;
		bias-pull-up;
	};
}; 

uart3_sleep: uart3_sleep {
	group1 {
		psels = <NRF_PSEL(UART_TX, 1, 12)>,
			<NRF_PSEL(UART_RX, 1, 13)>,
			<NRF_PSEL(UART_RTS, 1, 11)>,
			<NRF_PSEL(UART_CTS, 1, 1)>;
			low-power-enable;
	};
};

I connected jumper wires between these two boards and the jumper configs are as follows:

Pin nRF5340 DK nRF5340 Audio DK
Tx P1.12 P1.0
Rx P1.13 P1.1
RTS P1.11 P0.11
CTS P1.1 P0.10

With the above configs, I am getting HCI timeout in the nRF5340 Audio DK board (flashed with samples/bluetooth/peripheral)

ASSERTION FAIL [err == 0] @ WEST_TOPDIR/zephyr/subsys/bluetooth/host/hci_core.c:331
        command opcode 0x0c03 timeout with err -11

Please help me resolve this error and let me know if I am doing anything wrong. I appreciate any help you can provide.

Parents
  • Hello,

    First of all, please note that the intended way is not to change the dts files directly, but to create an overlay file in the applications folder. You can e.g. create a file called nrf5340dk_nrf5340_cpuapp.overlay, and it will be picked up by the compiler when you build for the board nrf5340dk_nrf5340_cpuapp. In the .overlay file is where you add the differences that describe where you want to differ from the .dts file. This way, you can have a special devicetree configuration in your application, without changing the board file directly (in case you ever do another custom board/application for the nRF5340DK).

    I am a bit confused. You say that the changes you made are for the nRF5340 Audio DK's .dts file. The nRF5340DK has nothing on P1.12, P1.13, P1.11 and P1.1 (the P1.1 is the TX pin for another UART instance). 

    So did you mix up the two sides in your table, or did you add something particular to your nRF5340DK's .dts files as well?

    Best regards,

    Edvin

  • Hi Edvin,

    Apologies for the confusion.

    Below are the changes made in the nRF5340 Audio DK DTS file,

    I mentioned the .overlay file. I created a new file `nrf5340_audio_dk_nrf5340_cpuapp_common.overlay` and the contents in the overlay file are as follows;

    / {
        chosen {
            zephyr,bt-uart = &uart3;
        };
    };
    
    &pinctrl {
    
        uart3_default: uart3_default {
    		group1 {
    			psels = <NRF_PSEL(UART_TX, 1, 12)>,
    				<NRF_PSEL(UART_RTS, 1, 11)>;
    		};
    		group2 {
    			psels = <NRF_PSEL(UART_RX, 1, 13)>,
    				<NRF_PSEL(UART_CTS, 1, 1)>;
    			bias-pull-up;
    		};
    	};
    };
    
    &uart3 {
    	status = "okay";
    	pinctrl-0 = <&uart3_default>;
    	pinctrl-names = "default";
    	current-speed = <115200>;
    };
    

    The nRF5340DK has nothing on P1.12, P1.13, P1.11 and P1.1 (the P1.1 is the TX pin for another UART instance). 

    In the overlay file (for nRF5340 Audio DK) I created a uart3 instance and configured these pins to be used. I hope this is the correct way to configure the pins.

    So did you mix up the two sides in your table, or did you add something particular to your nRF5340DK's .dts files as well

    I made the connection as per the table. I connected P1.12 (nRF5340 DK) to P1.0 (nRF5340 Audio DK).

    I did not add anything to nRF5340DK's DTS file. I created a .overlay in the application directory for the nRF5340 Audio DK board.

  • baskpann said:
    I did not add anything to nRF5340DK's DTS file. I created a .overlay in the application directory for the nRF5340 Audio DK board.

    Ok. Could you perhaps share that overlay file?

    baskpann said:
    In the overlay file (for nRF5340 Audio DK) I created a uart3 instance and configured these pins to be used. I hope this is the correct way to configure the pins.

    And this one, although I believe you are talking about the same one.

    Anyway, where do you specify that you are using a UART instance on the DK with the gpios that you are using on the DK? P1.12, P1.13, P1.11 and P1.01? And have you made sure no other enabled peripherals are using the same GPIOs? (The P1.01 is used by the network core's UART by default. Have you disabled this, or tried to use another pin on the DK?)

    Best regards,

    Edvin

  • Ok. Could you perhaps share that overlay file?

    Below are the overlay file contents,

    / {
        chosen {
            zephyr,bt-uart = &uart3;
        };
    };
    
    &pinctrl {
    
        uart3_default: uart3_default {
    		group1 {
    			psels = <NRF_PSEL(UART_TX, 1, 12)>,
    				<NRF_PSEL(UART_RTS, 1, 11)>;
    		};
    		group2 {
    			psels = <NRF_PSEL(UART_RX, 1, 13)>,
    				<NRF_PSEL(UART_CTS, 1, 1)>;
    			bias-pull-up;
    		};
    	};
    };
    
    &uart3 {
    	status = "okay";
    	pinctrl-0 = <&uart3_default>;
    	pinctrl-names = "default";
    	current-speed = <115200>;
    };
    

    Anyway, where do you specify that you are using a UART instance on the DK with the gpios that you are using on the DK?

    In the overlay file, I added the &pinctrl for the uart3 instance and I added uart3 as chosen

    nd have you made sure no other enabled peripherals are using the same GPIOs?

    I made sure no other peripherals were using the same GPIO. In the DK, I have erased the net core, only the app core is flashed with "samples/bluetooth/peripheral"

  • I used nrfjrprog --eraseall --coprocessor CP_NETWORK. I believe this disables P1.11 being used by the net core. Please correct me if I am wrong.

  • Hi Edvin, I have gone through a few devzone tickets and now understand what you mean by "Have you made sure no other enabled peripherals are using the same GPIOs?"

    Yes, I changed the nrf5340_audio_dk.overlay file.

    ```

    / {
        chosen {
            zephyr,bt-uart = &uart2;
        };
    };

    &pinctrl {
        uart2_default: uart2_default {
            group1 {
                psels = <NRF_PSEL(UART_TX, 1, 1)>,
                    <NRF_PSEL(UART_RTS, 0, 31)>;
            };
            group2 {
                psels = <NRF_PSEL(UART_RX, 1, 0)>,
                    <NRF_PSEL(UART_CTS, 1, 14)>;
                bias-pull-up;
            };
        };
    };

    &uart2 {
        status = "okay";
        pinctrl-0 = <&uart2_default>;
        pinctrl-names = "default";
        current-speed = <115200>;
    };

    &led1_blue {
        status = "disabled";
    };

    &led2_green {
        status = "disabled";
    };

    &led3_green {
        status = "disabled";
    };

    &rgb1_red {
        status = "disabled";
    };

    &rgb1_green {
        status = "disabled";
    };

    &rgb1_blue {
        status = "disabled";
    };

    &button3 {
        status = "disabled";
    };
    ```
    I am not using P1.11 as it is routed to the net core using gpio_fwd. I have replaced P1.11 with P0.31.


    I came across readme.rst (hci_uart). Here it is mentioned to run hci_uart in the net core with uart1 for bt-c2h-uart as uart0 can be used for console and shell.
    I am wondering how to enable uart1 for the net core. I couldn't find a way to enable uart1 instance for nRF5340 network core. Please let me know how to enable this instance, thanks in advance!
  • Hello,

    I don't follow. You have forwarded P1.11 to the net core? So you replaced P1.11 with P0.31 in the nRF5340 DK now? Does that work? Do you see any data coming out throug the UART from the DK then? (check with a logic analyzer).

    BR,

    Edvin

Reply Children
No Data
Related