Setting Different UART0 Baud Rates for MCUboot and Application

In my application, I have implemented Serial Recovery. The interface used for the transfer is UART0, which I also use in my application at a baud rate of 1M. When I enter MCUboot to update the firmware, I set a baud rate of 1M in mcumgr, but the update speed is extremely slow.

I would like to try reducing the baud rate in MCUboot to see if the issue is related to speed.

How can I set UART0 to 1M for my application and 115200 for MCUboot?

I tried modifying my device tree, but I couldn't find a solution. Does anyone have any suggestions?

Below is my device tree:

/dts-v1/;
#include <nordic/nrf52840_qiaa.dtsi>
#include "my_board-pinctrl.dtsi"
#include <zephyr/dt-bindings/input/input-event-codes.h>

/ {
	model = "My Board";
	compatible = "vendor,my_board";

	chosen {
		zephyr,sram = &sram0;
		zephyr,flash = &flash0;
		zephyr,code-partition = &slot0_partition;
		zephyr,uart-mcumgr = &uart0;
		zephyr,flash-controller = &flash_controller;
	};

	leds {
		compatible = "gpio-leds";

		led_red: led_0 {
			gpios = < &gpio0 8 GPIO_ACTIVE_LOW>;
			label = "Led Red";
		};

		led_green: led_1 {
			gpios = < &gpio1 9 GPIO_ACTIVE_LOW >;
			label = "Led Green";
		};

		led_blue: led_2 {
			gpios = < &gpio0 12 GPIO_ACTIVE_LOW >;
			label = "Led Blue";
		};
	};

	pwmleds {
		compatible = "pwm-leds";

		pwm_led_red: pwm_led_red {
			pwms = <&pwm0 0 PWM_MSEC(20) PWM_POLARITY_INVERTED>;
			label = "Pwm Led Red";
		};

		pwm_led_green: pwm_led_green {
			pwms = <&pwm1 1 PWM_MSEC(20) PWM_POLARITY_INVERTED>;
			label = "Pwm Led Green";
		};

		pwm_led_blue: pwm_led_blue {
			pwms = <&pwm2 2 PWM_MSEC(20) PWM_POLARITY_INVERTED>;
			label = "Pwm Led Blue";
		};
	};

	buttons {
		compatible = "gpio-keys";

		button0: button_0 {
			gpios = <&gpio0 07 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
			label = "Push button switch 0";
			zephyr,code = <INPUT_KEY_0>;
		};
	};

	aliases {
		mcuboot-button0 = &button0;
		mcuboot-led0 = &led_blue;
	};
};

&gpio1 {
	status = "okay";
};

&gpio0 {
	status = "okay";
};

&gpiote {
	status = "okay";
};

&pwm0 {
	status = "okay";
	pinctrl-0 = <&pwm0_default>;
	pinctrl-1 = <&pwm0_sleep>;
	pinctrl-names = "default", "sleep";
};

&pwm1 {
	status = "okay";
	pinctrl-0 = <&pwm1_default>;
	pinctrl-1 = <&pwm1_sleep>;
	pinctrl-names = "default", "sleep";
};

&pwm2 {
	status = "okay";
	pinctrl-0 = <&pwm2_default>;
	pinctrl-1 = <&pwm2_sleep>;
	pinctrl-names = "default", "sleep";
};

&uart0 {
	compatible = "nordic,nrf-uarte";
	status = "okay";
	current-speed = <1000000>;
	pinctrl-0 = <&uart0_default>;
	pinctrl-1 = <&uart0_sleep>;
	pinctrl-names = "default", "sleep";
};

&flash0 {
	partitions {
		compatible = "fixed-partitions";
		#address-cells = <1>;
		#size-cells = <1>;

		boot_partition: partition@0 {
			label = "mcuboot";
			reg = <0x00000000 DT_SIZE_K(48)>;
		};

		slot0_partition: partition@c000 {
			label = "image-0";
			reg = <0x0000c000 DT_SIZE_K(472)>;
		};

		slot1_partition: partition@82000 {
			label = "image-1";
			reg = <0x00082000 DT_SIZE_K(472)>;
		};
		
		storage_partition: partition@f8000 {
			label = "storage";
			reg = <0x000f8000 0x00008000>;
		};
	};
};

Parents Reply
  • In short: Overlay the &uart0 DTS node in sysbuild/mcuboot.overlay.

    I tried your advice and it worked. Thank you. But I don't understand why it wasn't working for me. I have the folder for my boards and their revisions in the sysbuild folder as well

    ├── sysbuild
        └── boards/mycompany/my_board
            └── my_board_1_0_0.conf
            └── my_board_1_0_0.overlay
        └── mcuboot.conf

    and I had created the overlay of &uart0 in the my_board_1_0_0.overlay file. So is my approach not correct? Sorry, but I've only recently switched to sysbuild and maybe I'm still missing something.

Children
Related