Hi,
Only the TX and RX of NRF52840 chip UART are used to test OpenThread CLI Demo. How can I change the configuration of UART in the original CLI Demo?
Thanks.
Hi,
Only the TX and RX of NRF52840 chip UART are used to test OpenThread CLI Demo. How can I change the configuration of UART in the original CLI Demo?
Thanks.
Hello,
Is it what GPIOs that are being used that you want to change? Or the UART instance?
Assuming it is the first one, you can try to add this to your CLI sample's boards\nrf52840dk_nrf52840.overlay (or the .overlay board of whatever board you are building for):
&pinctrl { uart0_default: uart0_default { group1 { psels = <NRF_PSEL(UART_TX, 0, 6)>, <NRF_PSEL(UART_RTS, 0, 5)>; }; group2 { psels = <NRF_PSEL(UART_RX, 0, 8)>, <NRF_PSEL(UART_CTS, 0, 7)>; bias-pull-up; }; }; uart0_sleep: uart0_sleep { group1 { psels = <NRF_PSEL(UART_TX, 0, 6)>, <NRF_PSEL(UART_RX, 0, 8)>, <NRF_PSEL(UART_RTS, 0, 5)>, <NRF_PSEL(UART_CTS, 0, 7)>; low-power-enable; }; }; };
And change the RX and TX pin numbers in both the uart0_default and the uart0_sleep to the ones that you want to use.
All the different boards have a board file (or a set of files), called <board_name>.dts and .dtsi. In there, you will find the default configuration for that board. If you want to change anything, you shouldn't modify these files directly, but instead create a <board_name>.overlay file in a folder called boards in your application's root folder, if it doesn't already exist, and then copy whatever you want from the .dts and .dtsi files, paste it into your overlay file, and perform any change you want to do in the .overlay file. This way, all applications will read the .dts(i) file first, and append whatever is in your .overlay file on top of that.
Best regards,
Edvin
Thank you very much for your reply.I want to change the UART instance.
How do I modify the UART configuration file if I use only RX and TX, but not CTS and RTS?
Thanks.
Hello,
Sorry for the late reply. I have been out of office for about two weeks. I am sorry for the inconvenience.
I have not tested this, but the way you set up and enable the uart1 instance, for instance, is like this:
/ { chosen { zephyr,shell-uart = &uart1; }; }; &pinctrl { uart1_default: uart1_default { group1 { psels = <NRF_PSEL(UART_RX, 1, 1)>; bias-pull-up; }; group2 { psels = <NRF_PSEL(UART_TX, 1, 2)>; }; }; uart1_sleep: uart1_sleep { group1 { psels = <NRF_PSEL(UART_RX, 1, 1)>, <NRF_PSEL(UART_TX, 1, 2)>; low-power-enable; }; }; }; &uart1 { compatible = "nordic,nrf-uarte"; status = "okay"; current-speed = <115200>; pinctrl-0 = <&uart1_default>; pinctrl-1 = <&uart1_sleep>; pinctrl-names = "default", "sleep"; /delete-property/ hw-flow-control; };
That would be in your nrf52840dk_nrf52840.overlay file.
I am not sure about the first part (zephyr, shell-uart = &uart1;)
I believe the openthread CLI uses the default, "zephyr, shell-uart", but I am not sure. Give it a go. Remember to set the pins that you want to use in the &pinctrl section, both in uart1_default and uart1_sleep.
Best regards,
Edvin
Hello,
Sorry for the late reply. I have been out of office for about two weeks. I am sorry for the inconvenience.
I have not tested this, but the way you set up and enable the uart1 instance, for instance, is like this:
/ { chosen { zephyr,shell-uart = &uart1; }; }; &pinctrl { uart1_default: uart1_default { group1 { psels = <NRF_PSEL(UART_RX, 1, 1)>; bias-pull-up; }; group2 { psels = <NRF_PSEL(UART_TX, 1, 2)>; }; }; uart1_sleep: uart1_sleep { group1 { psels = <NRF_PSEL(UART_RX, 1, 1)>, <NRF_PSEL(UART_TX, 1, 2)>; low-power-enable; }; }; }; &uart1 { compatible = "nordic,nrf-uarte"; status = "okay"; current-speed = <115200>; pinctrl-0 = <&uart1_default>; pinctrl-1 = <&uart1_sleep>; pinctrl-names = "default", "sleep"; /delete-property/ hw-flow-control; };
That would be in your nrf52840dk_nrf52840.overlay file.
I am not sure about the first part (zephyr, shell-uart = &uart1;)
I believe the openthread CLI uses the default, "zephyr, shell-uart", but I am not sure. Give it a go. Remember to set the pins that you want to use in the &pinctrl section, both in uart1_default and uart1_sleep.
Best regards,
Edvin