Hello,
I am wondering where to change the baud rate for the UART in the NRFConnect SDK using zephyr. I am working with the peripheral_uart example.
Thanks,
RJ
Hello,
I am wondering where to change the baud rate for the UART in the NRFConnect SDK using zephyr. I am working with the peripheral_uart example.
Thanks,
RJ
Try adding an overlay file nrf5340dk_nrf5340_cpuapp.overlay (use the same board-name as the one you're bulding with) to your project with the following content:
&uart0 {
status = "okay";
current-speed = <new baud rate>; //<115200>;
};
That will overwrite the default speed set in <ncs location>\zephyr\boards\arm\nrf5340dk_nrf5340\nrf5340_cpuapp_common.dts
Best regards,
Simon
There is a prj.overlay file in the project already with a declaration of Uart0. is this the same?
I talked to the developer of the central_uart and peripheral_uart samples and the file prj.overlay does basically nothing. The file will be removed soon. Please add it to an overlay file in the following manner: <board name>.overlay. Check out Set devicetree overlays for more information about this.
Best regards,
Simon
Simon I changed the baud rate in the overlay file. However, it is still outputting a baud rate off 115.2k instead of a baud rate of 9600. See logic analyzer data and overlay file below.
/* SPDX-License-Identifier: Apache-2.0 */
&uart1 {
compatible = "nordic,nrf-uarte";
current-speed = <9600>; //<115200>;
status = "okay";
tx-pin = <33>;
rx-pin = <32>;
};

Have you checked what it's set to in the file <application>/<build>/zephyr/zephyr.dts? Search for uart1 an check what current-speed is equal to.