Modbus Stops workng when enabling MCUBOOT configurations

Hi my name is Assaf im using Nrf9160 on custom pcb with SDK and toolchain v2.5.2.

I made modbus code which works just fine but when im enabeling the MCUBOOT related configuration i get timeout error from the modbus, it means the modbus is missconfigurated.

The main code here is not relevant since it works just fine without the MCUBOOT related configurations and the configurations are important becasue i need to have FOTA featrure.


This is my app.overlay:

/ {
    chosen {
        zephyr,console = &uart0;
    };

    leds {
        compatible = "gpio-leds";
        led0: led_0 {
            gpios = <&gpio0 2 0>;
            label = "Green LED 1";
        };
        led1: led_1 {
            gpios = <&gpio0 3 0>;
            label = "Green LED 2";
        };
        led2: led_2 {
            gpios = <&gpio0 4 0>;
            label = "Green LED 3";
        };
        led3: led_3 {
            gpios = <&gpio0 5 0>;
            label = "Green LED 4";
        };
    };
};

/* Console */
&uart0 {
    status = "okay";
    current-speed = <115200>;
};

&uart1 {
    status = "okay";
    current-speed = <9600>;

    pinctrl-0 = <&uart1_default>;
    pinctrl-1 = <&uart1_sleep>;
    pinctrl-names = "default", "sleep";

    modbus0: modbus {
        compatible = "zephyr,modbus-serial";
        label = "MODBUS_0";
        status = "okay";

        de-gpios = <&gpio0 11 0>;
        re-gpios = <&gpio0  9 0>;
    };
};

&pinctrl {
    /* Active state pins for UART1 */
    uart1_default: uart1_default {
   
        group2 {
            psels = <NRF_PSEL(UART_RX, 0, 22)>, <NRF_PSEL(UART_TX, 0, 27)>;
            bias-pull-up;
        };

        group1 {
            psels = <NRF_PSEL(UART_TX, 0, 27)>;
        };
    };

    /* Low-power (sleep) state pins for UART1 */
    uart1_sleep: uart1_sleep {
        group1 {
            psels = <NRF_PSEL(UART_TX, 0, 27)>,
                    <NRF_PSEL(UART_RX, 0, 22)>;
            low-power-enable;
        };
    };
};


&uart0_default {
    group1 {
        psels = <NRF_PSEL(UART_TX, 0, 29)>;
    };

    group2 {
        psels = <NRF_PSEL(UART_RX, 0, 28)>;
    };
};

&uart0_sleep {
    group1 {
        psels = <NRF_PSEL(UART_TX, 0, 29)>, <NRF_PSEL(UART_RX, 0, 28)>;
    };

};


&spi3_sleep {
    group1 {
        psels = <NRF_PSEL(SPIM_SCK, 0, 13)>, <NRF_PSEL(SPIM_MISO, 0, 12)>;
    };
};

&spi3_default {
    group1 {
        psels = <NRF_PSEL(SPIM_SCK, 0, 13)>, <NRF_PSEL(SPIM_MISO, 0, 12)>;
    };
};

&button3 {
    gpios = <&gpio0 14 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
};




(I have tried switching to UART2 but it made no impact)

and those are the MCUBOOT realted configurations:
CONFIG_BOOTLOADER_MCUBOOT=y
CONFIG_DFU_TARGET=y
CONFIG_DFU_TARGET_MCUBOOT=y
CONFIG_IMG_MANAGER=y

CONFIG_TFM_LOG_LEVEL_SILENCE=y
CONFIG_TFM_SECURE_UART=n


CONFIG_MCUBOOT_IMG_MANAGER=y
CONFIG_MCUBOOT_SIGNATURE_KEY_FILE="keys/private_key.pem"
CONFIG_TFM_PARTITION_FIRMWARE_UPDATE=n



This is the log without the mcuboot related conf:
[00:00:10.499,298] <inf> rit_mqtt: --------------------------
[00:00:10.499,298] <inf> rit_mqtt: !!!!!
[00:00:10.499,328] <inf> rit_mqtt: PING: ----SENDING PING----
[00:00:10.499,328] <inf> rit_mqtt: !!!!!
[00:00:10.499,359] <inf> rit_mqtt: --------------------------
[00:00:10.499,725] <inf> rit_mqtt: Subscription request sent.
[00:00:11.201,110] <inf> rit_mqtt: SUBACK received for message id 2469
[00:00:11.401,458] <inf> rit_mqtt: PUBACK received for message id 10499
[00:00:11.501,831] <inf> rit_mqtt: Ping received from broker.
[00:00:12.498,474] <inf> rit_mqtt: --------------------------
[00:00:12.498,504] <inf> rit_mqtt: !!!!!
[00:00:12.498,504] <inf> rit_mqtt: SENSOR LOG: ----SENDING SENSOR DATA----
[00:00:12.498,535] <inf> rit_mqtt: !!!!!
[00:00:12.498,535] <inf> rit_mqtt: --------------------------
[00:00:12.498,565] <inf> rit_mqtt: Sendig PLC registers for logging
[00:00:12.554,168] <inf> rit_mqtt: Ping sent
[00:00:13.054,992] <inf> rit_mqtt: PUBACK received for message id 12553
+CSCON: 0
+CEREG: 2
+CEREG: 1,"1D75","00157A01",7,,,"11100000","11100000"
+CEREG: 2
+CEREG: 1,"1D75","0015B202",7,,,"11100000","11100000"
[00:01:12.554,260] <inf> rit_mqtt: --------------------------
[00:01:12.554,290] <inf> rit_mqtt: !!!!!
[00:01:12.554,290] <inf> rit_mqtt: SENSOR LOG: ----SENDING SENSOR DATA----
[00:01:12.554,321] <inf> rit_mqtt: !!!!!
[00:01:12.554,321] <inf> rit_mqtt: --------------------------
[00:01:12.554,351] <inf> rit_mqtt: Sendig PLC registers for logging
[00:01:12.619,628] <inf> rit_mqtt: Ping sent
+CEREG: 2
+CEREG: 1,"1D75","00157A01",7,,,"11100000","11100000"
+CSCON: 1
+CSCON: 0
+CEREG: 1,"1D75","0015B202",7,,,"11100000","11100000"
+CSCON: 1
[00:01:27.450,347] <inf> rit_mqtt: PUBACK received for message id 7074



and this is the log with the related configurations:
00:00:19.404,754] <inf> rit_mqtt: --------------------------
[00:00:19.404,754] <inf> rit_mqtt: !!!!!
[00:00:19.404,785] <inf> rit_mqtt: SENSOR LOG: ----SENDING SENSOR DATA----
[00:00:19.404,815] <inf> rit_mqtt: !!!!!
[00:00:19.404,815] <inf> rit_mqtt: --------------------------
[00:00:19.404,846] <inf> rit_mqtt: Sendig PLC registers for logging
[00:00:19.505,004] <wrn> modbus: Client wait-for-RX timeout
[00:00:19.505,035] <err> modbus_handler: FC03(4400) failed with -116
[00:00:19.505,065] <err> modbus_handler: Timed out: check A/B wiring, parity/baud (9600 8N1), DE/RE/DIR handling, slave power, and ID=1.
[00:00:19.505,065] <err> rit_mqtt: sensor_log_work_fn: Failed to read registers, do not send data for logging

Related