This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Full modem firmware update for modem v1.3.0

I am working in a project where we want to be able to do full modem firmware update with FOTA for modem version 1.3.x. According to the release notes, in order to do this, we need to use the .cbor file in the zip from the release.

I have tried to follow the example in samples/nrf9160/http_update/full_modem_update. This sample however only uses v1.2.1 and v1.2.2. Can I follow the same steps for v1.3.x using the .cbor file? Or do I need to do something more? Like some digest?

I have modified the sample to fit my project. My hardware has a nrf9160 which downloads the firmware via LwM2M. The hardware also has an external flash memory which I use for the firmware update. I am currently using NCS version 1.6.1.

Parents
  • Hi  Andreas,
    I have the similar situation .i want to update the modem firmware from 1.2.3 to 1.3.1 over the air. I am using AWS(MQTT) over the update,
    can you please give me hint which .bin file I have to used.

    Thanks

  • Or, if you want to use a URL directly in your application, and maybe use the download client library to download it, you can use the following URL:

    https://nrfconnectsdk.s3.eu-central-1.amazonaws.com/fmfu_1.3.1.bin

    You can look at the sample https://github.com/nrfconnect/sdk-nrf/tree/main/samples/nrf9160/http_update/full_modem_update for reference.

    /Andreas

  • if i use .cbor files  i am getting this error
    I am using nrfConnect sdk 1.5.0

    2022-03-09T15:02:35.224Z DEBUG modem << D: MQTT_EVT_PUBACK: id = 53713 result = 0
    2022-03-09T15:02:36.103Z DEBUG modem << I: Configuring socket timeout (60 s)
    2022-03-09T15:02:36.106Z DEBUG modem << I: Connecting to dl40-fota.s3-eu-west-1.amazonaws.com
    2022-03-09T15:02:36.243Z DEBUG modem << I: Downloading: firmware.update.image.cbor [0]
    2022-03-09T15:02:36.245Z DEBUG modem << D: AWS_FOTA_EVT_START
    2022-03-09T15:02:36.247Z DEBUG modem << AWS_IOT_EVT_FOTA_START
    2022-03-09T15:02:36.250Z DEBUG modem << PSM mode off requested due to FOTA update
    2022-03-09T15:02:37.154Z DEBUG modem << Feeding watchdog
    2022-03-09T15:02:37.269Z DEBUG modem << I: Downloaded 1024/2015653 bytes (0%)
    2022-03-09T15:02:37.271Z DEBUG modem << E: No supported image type found
    2022-03-09T15:02:37.273Z DEBUG modem << E: Unknown image type
    2022-03-09T15:02:37.275Z DEBUG modem << E: dfu_target_init error -134
    2022-03-09T15:02:37.276Z DEBUG modem << E: FOTA download failed, report back
    2022-03-09T15:02:37.278Z DEBUG modem << E: AWS_FOTA_EVT_ERROR
    2022-03-09T15:02:37.280Z DEBUG modem << AWS_IOT_EVT_FOTA_ERROR/nPublication reset to default value/nI: Modem upgrade aborted.
    2022-03-09T15:02:37.282Z DEBUG modem << E: Failed to close modem DFU socket.
    2022-03-09T15:02:37.283Z DEBUG modem << E: Unable to clean up dfu_target
    2022-03-09T15:02:37.284Z DEBUG modem << E: Unable to reset DFU target
    2022-03-09T15:02:37.287Z DEBUG modem << I: Fragment refused, download stopped.

  • What was the full URL you used in this test?

    It looks to me like you either get the incorrect file or that you have not set

    CONFIG_DFU_TARGET_FULL_MODEM=y

    in your config, which you need to do. You can look in the file subsys/dfu/dfu_target/src/dfu_target.c for the ifdefs in dfu_target_img_type function.

    Also, I am using nrf v1.8.0 currently, so there might be some changes from v1.5.0, but should probably be the same in this area.

  • Thanks 
    Andreas

    I have successfully updated from 1.2.3 to 1.2.7 but after doing configuration .i am still getting the error

    RRC mode: Connected
    
    
    
    
    D: MQTT_EVT_PUBACK: id = 27137 result = 0
    
    
    
    
    I: Configuring socket timeout (60 s)
    
    
    
    
    I: Connecting to dl40-fota.s3-eu-west-1.amazonaws.com
    
    
    
    
    I: Downloading: fmfu_1.3.0.bin [0]
    
    
    
    
    D: AWS_FOTA_EVT_START
    
    
    
    
     AWS_IOT_EVT_FOTA_START 
    
    
    
    
    PSM mode off  requested due to FOTA update
    
    
    
    
    I: Downloaded 1024/1991053 bytes (0%)
    
    
    
    
    E: No supported image type found
    
    
    
    
    E: Unknown image type
    
    
    
    
    E: dfu_target_init error -134
    
    
    
    
    E: FOTA download failed, report back
    
    
    
    
    E: AWS_FOTA_EVT_ERROR
    
    
Reply
  • Thanks 
    Andreas

    I have successfully updated from 1.2.3 to 1.2.7 but after doing configuration .i am still getting the error

    RRC mode: Connected
    
    
    
    
    D: MQTT_EVT_PUBACK: id = 27137 result = 0
    
    
    
    
    I: Configuring socket timeout (60 s)
    
    
    
    
    I: Connecting to dl40-fota.s3-eu-west-1.amazonaws.com
    
    
    
    
    I: Downloading: fmfu_1.3.0.bin [0]
    
    
    
    
    D: AWS_FOTA_EVT_START
    
    
    
    
     AWS_IOT_EVT_FOTA_START 
    
    
    
    
    PSM mode off  requested due to FOTA update
    
    
    
    
    I: Downloaded 1024/1991053 bytes (0%)
    
    
    
    
    E: No supported image type found
    
    
    
    
    E: Unknown image type
    
    
    
    
    E: dfu_target_init error -134
    
    
    
    
    E: FOTA download failed, report back
    
    
    
    
    E: AWS_FOTA_EVT_ERROR
    
    
Children
  • The v1.2.3 -> v1.2.7 is not using FMFU, it is using the modem delta update, which is another function.

    Without your complete configuration it is hard to know if that is correct or not. But what I would have done is to somehow print the 1024 bytes you actually do download, and check if they are the same as the fmfu_1.3.0.bin file if you download that on your computer. And then, if they are the same, I would debug the code where the image type is determined, that I pointed out previously. I still think you have not succeeded in enabling FMFU.

  • These are my configuration.

    Yes for delta version i used another .bin file  that worked.
     i had  also attached dfu_target.c file 

    Thanks

    # AWS FOTA
    CONFIG_AWS_FOTA=y
    CONFIG_FOTA_DOWNLOAD=y
    CONFIG_DFU_TARGET=y
    CONFIG_DFU_TARGET_FULL_MODEM=y ##added by waqar for modem firmware full update

    /*
     * Copyright (c) 2019 Nordic Semiconductor ASA
     *
     * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
     */
    #include <zephyr.h>
    #include <logging/log.h>
    #include <dfu/mcuboot.h>
    #include <dfu/dfu_target.h>
    
    #define DEF_DFU_TARGET(name) \
    static const struct dfu_target dfu_target_ ## name  = { \
    	.init = dfu_target_ ## name ## _init, \
    	.offset_get = dfu_target_## name ##_offset_get, \
    	.write = dfu_target_ ## name ## _write, \
    	.done = dfu_target_ ## name ## _done, \
    }
    
    #ifdef CONFIG_DFU_TARGET_MODEM_DELTA
    #include "dfu/dfu_target_modem_delta.h"
    DEF_DFU_TARGET(modem_delta);
    #endif
    #ifdef CONFIG_DFU_TARGET_MCUBOOT
    #include "dfu/dfu_target_mcuboot.h"
    DEF_DFU_TARGET(mcuboot);
    #endif
    #ifdef CONFIG_DFU_TARGET_FULL_MODEM
    #include "dfu/dfu_target_full_modem.h"
    DEF_DFU_TARGET(full_modem);
    #endif
    
    #define MIN_SIZE_IDENTIFY_BUF 32
    
    LOG_MODULE_REGISTER(dfu_target, CONFIG_DFU_TARGET_LOG_LEVEL);
    
    static const struct dfu_target *current_target;
    
    int dfu_target_img_type(const void *const buf, size_t len)
    {
    	if (len < MIN_SIZE_IDENTIFY_BUF) {
    		return -EAGAIN;
    	}
    #ifdef CONFIG_DFU_TARGET_MCUBOOT
    	if (dfu_target_mcuboot_identify(buf)) {
    		return DFU_TARGET_IMAGE_TYPE_MCUBOOT;
    	}
    #endif
    #ifdef CONFIG_DFU_TARGET_MODEM_DELTA
    	if (dfu_target_modem_delta_identify(buf)) {
    		return DFU_TARGET_IMAGE_TYPE_MODEM_DELTA;
    	}
    #endif
    #ifdef CONFIG_DFU_TARGET_FULL_MODEM
    	if (dfu_target_full_modem_identify(buf)) {
    		return DFU_TARGET_IMAGE_TYPE_FULL_MODEM;
    	}
    #endif
    	LOG_ERR("No supported image type found");
    	return -ENOTSUP;
    }
    
    int dfu_target_init(int img_type, size_t file_size, dfu_target_callback_t cb)
    {
    	const struct dfu_target *new_target = NULL;
    
    #ifdef CONFIG_DFU_TARGET_MCUBOOT
    	if (img_type == DFU_TARGET_IMAGE_TYPE_MCUBOOT) {
    		new_target = &dfu_target_mcuboot;
    	}
    #endif
    #ifdef CONFIG_DFU_TARGET_MODEM_DELTA
    	if (img_type == DFU_TARGET_IMAGE_TYPE_MODEM_DELTA) {
    		new_target = &dfu_target_modem_delta;
    	}
    #endif
    #ifdef CONFIG_DFU_TARGET_FULL_MODEM
    	if (img_type == DFU_TARGET_IMAGE_TYPE_FULL_MODEM) {
    		new_target = &dfu_target_full_modem;
    	}
    #endif
    	if (new_target == NULL) {
    		LOG_ERR("Unknown image type");
    		return -ENOTSUP;
    	}
    
    	/* The user is re-initializing with an previously aborted target.
    	 * Avoid re-initializing generally to ensure that the download can
    	 * continue where it left off. Re-initializing is required for
    	 * modem_delta upgrades to re-open the DFU socket that is closed on
    	 * abort.
    	 */
    	if (new_target == current_target
    	   && img_type != DFU_TARGET_IMAGE_TYPE_MODEM_DELTA) {
    		return 0;
    	}
    
    	current_target = new_target;
    
    	return current_target->init(file_size, cb);
    }
    
    int dfu_target_offset_get(size_t *offset)
    {
    	if (current_target == NULL) {
    		return -EACCES;
    	}
    
    	return current_target->offset_get(offset);
    }
    
    int dfu_target_write(const void *const buf, size_t len)
    {
    	if (current_target == NULL || buf == NULL) {
    		return -EACCES;
    	}
    
    	return current_target->write(buf, len);
    }
    
    int dfu_target_done(bool successful)
    {
    	int err;
    
    	if (current_target == NULL) {
    		return -EACCES;
    	}
    
    	err = current_target->done(successful);
    	if (err != 0) {
    		LOG_ERR("Unable to clean up dfu_target");
    		return err;
    	}
    
    	if (successful) {
    		current_target = NULL;
    	}
    
    	return 0;
    }
    
    int dfu_target_reset(void)
    {
    	if (current_target != NULL) {
    		int err = current_target->done(false);
    
    		if (err != 0) {
    			LOG_ERR("Unable to clean up dfu_target");
    			return err;
    		}
    	}
    	current_target = NULL;
    	return 0;
    }
    

  • It would be more useful to get the "build_output/zephyr/.config" file, as that will hold your actual output for the configs. Because I think that you maybe don't actually get the FULL_MODEM set correctly, as that has several dependencies, for example FMFU_FDEV.

    (Also, are you sure that you have an external flash memory and has set that up correctly? That is required for FMFU.)

    By now this seems to go beyond the scope of this thread. I suggest you create a new thread for your specific usecase where you can get appropriate support.

Related