AWS_IOT_EVT_FOTA_ERROR when I try to perform aws fota

Hi all,

I'm trying to perform aws fota on my nrf9151, I've followed this https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/libraries/networking/aws_fota.html#aws-iot-jobs. I always got AWS_IOT_EVT_FOTA_ERROR after AWS_IOT_EVT_FOTA_START.

here is my job txt file

{
  "operation": "app_fw_update",
  "fwversion": "v1.0.2",
  "size": 181124,   --> don't know if I have to change it or not, it's not specifie in documentation
  "location": {
    "protocol": "http",
    "host": "my-bucket.s3.eu-west-3.amazonaws.com",
    "path": "zephyr.bin"
   }
}

My prj.conf

CONFIG_DFU_TARGET=y
CONFIG_DOWNLOAD_CLIENT=y
CONFIG_DOWNLOAD_CLIENT_STACK_SIZE=4096
CONFIG_FOTA_DOWNLOAD=y
CONFIG_AWS_FOTA=y
CONFIG_DOWNLOAD_CLIENT_LOG_LEVEL_ERR=y
CONFIG_DOWNLOAD_CLIENT_LOG_LEVEL_WRN=y
CONFIG_DOWNLOAD_CLIENT_LOG_LEVEL_INF=y

I created a job for my thing link with my job.txt, after fota error event here is what I see

for the moment in my code I only try to download, not perform update

static void aws_iot_event_handler(const struct aws_iot_evt *const evt)
{
	switch (evt->type) {
	case AWS_IOT_EVT_CONNECTING:
		LOG_INF("AWS_IOT_EVT_CONNECTING");
		break;
	case AWS_IOT_EVT_CONNECTED:
		LOG_INF("AWS_IOT_EVT_CONNECTED");
		on_aws_iot_evt_connected(evt);
		break;
	case AWS_IOT_EVT_DISCONNECTED:
		LOG_INF("AWS_IOT_EVT_DISCONNECTED");
		on_aws_iot_evt_disconnected();
		break;
	case AWS_IOT_EVT_DATA_RECEIVED:
		LOG_INF("AWS_IOT_EVT_DATA_RECEIVED");
		handle_received_topic(evt);							 
		break;
	case AWS_IOT_EVT_PUBACK:
		LOG_INF("AWS_IOT_EVT_PUBACK, message ID: %d", evt->data.message_id);
		break;
	case AWS_IOT_EVT_PINGRESP:
		LOG_INF("AWS_IOT_EVT_PINGRESP");
		break;
	case AWS_IOT_EVT_FOTA_START:
		LOG_INF("AWS_IOT_EVT_FOTA_START");
		break;
	case AWS_IOT_EVT_FOTA_ERASE_PENDING:
		LOG_INF("AWS_IOT_EVT_FOTA_ERASE_PENDING");
		break;
	case AWS_IOT_EVT_FOTA_ERASE_DONE:
		LOG_INF("AWS_FOTA_EVT_ERASE_DONE");
		break;
	case AWS_IOT_EVT_FOTA_DONE:
		LOG_INF("AWS_IOT_EVT_FOTA_DONE");
		on_aws_iot_evt_fota_done(evt);
		break;
	case AWS_IOT_EVT_FOTA_DL_PROGRESS:
		LOG_INF("AWS_IOT_EVT_FOTA_DL_PROGRESS, (%d%%)", evt->data.fota_progress);
		break;
	case AWS_IOT_EVT_ERROR:
		LOG_INF("AWS_IOT_EVT_ERROR, %d", evt->data.err);
		FATAL_ERROR();
		break;
	case AWS_IOT_EVT_FOTA_ERROR:
		LOG_INF("AWS_IOT_EVT_FOTA_ERROR %d", evt->data.err);
		break;
	default:
		LOG_INF("Unknown AWS IoT event type: %d", evt->type);
		break;
	}
}

static void on_aws_iot_evt_fota_done(const struct aws_iot_evt *const evt)
{
	int err;

	/* Tear down MQTT connection. */
	(void)aws_iot_disconnect();
	(void)k_work_cancel_delayable(&connect_work);

	/* If modem FOTA has been carried out, the modem needs to be reinitialized.
	 * This is carried out by bringing the network interface down/up.
	 */
	if (evt->data.image & DFU_TARGET_IMAGE_TYPE_ANY_MODEM) {
		LOG_INF("Modem FOTA done, reinitializing the modem");

	} else if (evt->data.image & DFU_TARGET_IMAGE_TYPE_ANY_APPLICATION) {
		LOG_INF("Application FOTA done, rebooting");
		IF_ENABLED(CONFIG_REBOOT, (sys_reboot(0)));
	} else {
		LOG_INF("Unexpected FOTA image type");
	}
}

and here is my terminal output

[00:03:38.554][INF].[aws_iot_event_handler:500] AWS_IOT_EVT_PUBACK, message ID: 21636
[00:03:38.713][INF].[aws_iot_event_handler:500] AWS_IOT_EVT_PUBACK, message ID: 13662
[00:03:38.724][INF].[aws_iot_event_handler:506] AWS_IOT_EVT_FOTA_START
.....
[00:03:39.794][INF].[aws_iot_event_handler:526] AWS_IOT_EVT_FOTA_ERROR 0
[00:03:40.001][INF].[aws_iot_event_handler:500] AWS_IOT_EVT_PUBACK, message ID: 58818
[00:03:40.162][INF].[aws_iot_event_handler:500] AWS_IOT_EVT_PUBACK, message ID: 721

Download client say my bin file is not supported

<inf> download_client: Downloaded 2048/242388 bytes (0%)
<err> dfu_target: No supported image type found
<err> fota_download: Unknown image

My file (zephyr.bin) is the result of the build of my app located to build/zephyr/ generated by vscode. Should I do something particular to build bin for FOTA ?

EDIT: if I understand well, my issue is normal because I have to use mcuboot to generate app_update.bin file, but right now I'm stuck when I add 

CONFIG_BOOTLOADER_MCUBOOT=y

here is the error for my for my custom nrf9151 non secure board

/Users/sim/Documents/workspace_dev/GG/geo/build_gcg_debug/mcuboot/zephyr/include/generated/syscalls/kernel.h:135: undefined reference to `z_impl_k_sleep'
/opt/nordic/ncs/toolchains/20d68df7e5/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: /Users/sim/Documents/workspace_dev/GG/geo/build_gcg_debug/mcuboot/zephyr/include/generated/syscalls/kernel.h:135: undefined reference to `z_impl_k_sleep'
/opt/nordic/ncs/toolchains/20d68df7e5/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/drivers/flash/libdrivers__flash.a(spi_nor.c.obj):(.rodata.spi_nor_config_0+0x0): undefined reference to `__device_dts_ord_94'

I'm using littlefs with external flash (for log storage only) and CONFIG_PM_EXTERNAL_FLASH_MCUBOOT_SECNDARY=n also,maybe it's link (to add it I've followed this link https://www.youtube.com/watch?v=zgMMC0eWkkM)

My problem seems to be the same here https://devzone.nordicsemi.com/f/nordic-q-a/107256/problem-using-an-external-flash-together-with-mcuboot

I'll open a specific ticket with better description

Thanks for your help

Parents Reply Children
Related