Exploring Connectivity Options for AWS IoT: Do We Need IoT SIM Cards?

Hi,

      I am currently working with the nRF9160DK board, using SDK version 2.5.1, and I have encountered an issue regarding connectivity to the AWS IoT cloud.

I have successfully connected my board to MQTT and have been able to publish and subscribe to topics using a regular SIM card with a data pack,so I confirmed that internet connection is done. However, when attempting to connect to AWS IoT using the same SIM card in the provided sample code, I am experiencing connectivity issues.

I have ensured that I configured all necessary parameters in the sample code given, including:

  • CONFIG_AWS_IOT_BROKER_HOST_NAME
  • CONFIG_MQTT_HELPER_SEC_TAG
  • CONFIG_AWS_IOT_CLIENT_ID_STATIC

Despite this, I am not receiving the expected output,
After flashing the sample, we can receive those two lines in the image. I'm not getting the remaining lines.


and I'm uncertain whether the SIM card compatibility could be a factor, or if there might be an issue with my code implementation.

Could you please provide guidance on whether an IoT-specific SIM card (LTE-M or NB-IoT) is required for connecting to AWS IoT? Additionally, I would appreciate any insights or troubleshooting tips you may have regarding this connectivity issue.

Thank you in advance for your assistance.

Parents
  • Hi,

    Did you run unmodified AWS IoT sample?

    Can you provide full log which you get when running the sample?

    Best regards,
    Dejan

  • Hi,
        Yeah i used unmodified aws iot sample but just added few things like certificate related changes like below

    • CONFIG_AWS_IOT_BROKER_HOST_NAME
    • CONFIG_MQTT_HELPER_SEC_TAG
    • CONFIG_AWS_IOT_CLIENT_ID_STATIC
      my output

      my sample code main.c
      /*
       * Copyright (c) 2020 Nordic Semiconductor ASA
       *
       * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
       */
      
      #include <zephyr/kernel.h>
      #include <zephyr/sys/reboot.h>
      #include <zephyr/dfu/mcuboot.h>
      #include <zephyr/logging/log.h>
      #include <zephyr/logging/log_ctrl.h>
      #include <zephyr/net/conn_mgr_connectivity.h>
      #include <zephyr/net/conn_mgr_monitor.h>
      #include <net/aws_iot.h>
      #include <stdio.h>
      #include <stdlib.h>
      #include <hw_id.h>
      #include <modem/modem_info.h>
      
      #include "json_payload.h"
      
      /* Register log module */
      LOG_MODULE_REGISTER(aws_iot_sample, CONFIG_AWS_IOT_SAMPLE_LOG_LEVEL);
      
      /* Macros used to subscribe to specific Zephyr NET management events. */
      #define L4_EVENT_MASK (NET_EVENT_L4_CONNECTED | NET_EVENT_L4_DISCONNECTED)
      #define CONN_LAYER_EVENT_MASK (NET_EVENT_CONN_IF_FATAL_ERROR)
      
      #define MODEM_FIRMWARE_VERSION_SIZE_MAX 50
      
      /* Macro called upon a fatal error, reboots the device. */
      #define FATAL_ERROR()					\
      	LOG_ERR("Fatal error! Rebooting the device.");	\
      	LOG_PANIC();					\
      	IF_ENABLED(CONFIG_REBOOT, (sys_reboot(0)))
      
      /* Zephyr NET management event callback structures. */
      static struct net_mgmt_event_callback l4_cb;
      static struct net_mgmt_event_callback conn_cb;
      
      /* Forward declarations. */
      static void shadow_update_work_fn(struct k_work *work);
      static void connect_work_fn(struct k_work *work);
      static void aws_iot_event_handler(const struct aws_iot_evt *const evt);
      
      /* Work items used to control some aspects of the sample. */
      static K_WORK_DELAYABLE_DEFINE(shadow_update_work, shadow_update_work_fn);
      static K_WORK_DELAYABLE_DEFINE(connect_work, connect_work_fn);
      
      /* Static functions */
      
      static int app_topics_subscribe(void)
      {
      	int err;
      	static const char custom_topic[] = "iot/example";
      	static const char custom_topic_2[] = "iot/example_2";
      
      	const struct aws_iot_topic_data topics_list[CONFIG_AWS_IOT_APP_SUBSCRIPTION_LIST_COUNT] = {
      		[0].str = custom_topic,
      		[0].len = strlen(custom_topic),
      		[1].str = custom_topic_2,
      		[1].len = strlen(custom_topic_2)
      	};
      
      	err = aws_iot_subscription_topics_add(topics_list, ARRAY_SIZE(topics_list));
      	if (err) {
      		LOG_ERR("aws_iot_subscription_topics_add, error: %d", err);
      		FATAL_ERROR();
      		return err;
      	}
      
      	return 0;
      }
      
      static int aws_iot_client_init(void)
      {
      	int err;
      	struct aws_iot_config config = { 0 };
      
      #if defined(CONFIG_AWS_IOT_SAMPLE_DEVICE_ID_USE_HW_ID)
      	char device_id[HW_ID_LEN] = { 0 };
      
      	/* Get unique hardware ID, can be used as AWS IoT MQTT broker device/client ID. */
      	err = hw_id_get(device_id, ARRAY_SIZE(device_id));
      	if (err) {
      		LOG_ERR("Failed to retrieve device ID, error: %d", err);
      		FATAL_ERROR();
      		return err;
      	}
      
      	/* To use HW ID as MQTT device/client ID set the CONFIG_AWS_IOT_CLIENT_ID_APP option.
      	 * Otherwise the ID set by CONFIG_AWS_IOT_CLIENT_ID_STATIC is used.
      	 */
      	config.client_id = device_id;
      	config.client_id_len = strlen(device_id);
      
      	LOG_INF("Hardware ID: %s", device_id);
      #endif /* CONFIG_AWS_IOT_SAMPLE_DEVICE_ID_USE_HW_ID */
      
      	err = aws_iot_init(&config, aws_iot_event_handler);
      	if (err) {
      		LOG_ERR("AWS IoT library could not be initialized, error: %d", err);
      		FATAL_ERROR();
      		return err;
      	}
      
      	/* Add application specific non-shadow topics to the AWS IoT library.
      	 * These topics will be subscribed to when connecting to the broker.
      	 */
      	err = app_topics_subscribe();
      	if (err) {
      		LOG_ERR("Adding application specific topics failed, error: %d", err);
      		FATAL_ERROR();
      		return err;
      	}
      
      	return 0;
      }
      
      /* System Workqueue handlers. */
      
      static void shadow_update_work_fn(struct k_work *work)
      {
      	int err;
      	char message[CONFIG_AWS_IOT_SAMPLE_JSON_MESSAGE_SIZE_MAX] = "NRF Device";
      	struct payload payload = {
      		.state.reported.uptime = k_uptime_get(),
      		.state.reported.app_version = CONFIG_AWS_IOT_SAMPLE_APP_VERSION,
      	};
      	struct aws_iot_data tx_data = {
      		.qos = MQTT_QOS_0_AT_MOST_ONCE,
      		.topic.type = AWS_IOT_SHADOW_TOPIC_UPDATE,
      	};
      
      	if (IS_ENABLED(CONFIG_MODEM_INFO)) {
      		char modem_version_temp[MODEM_FIRMWARE_VERSION_SIZE_MAX];
      
      		err = modem_info_get_fw_version(modem_version_temp,
      						ARRAY_SIZE(modem_version_temp));
      		if (err) {
      			LOG_ERR("modem_info_get_fw_version, error: %d", err);
      			FATAL_ERROR();
      			return;
      		}
      
      		payload.state.reported.modem_version = modem_version_temp;
      	}
      
      	err = json_payload_construct(message, sizeof(message), &payload);
      	if (err) {
      		LOG_ERR("json_payload_construct, error: %d", err);
      		FATAL_ERROR();
      		return;
      	}
      
      	tx_data.ptr = message;
      	tx_data.len = strlen(message);
      
      	LOG_INF("Publishing message: %s to AWS IoT shadow", message);
      
      	err = aws_iot_send(&tx_data);
      	if (err) {
      		LOG_ERR("aws_iot_send, error: %d", err);
      		FATAL_ERROR();
      		return;
      	}
      
      	(void)k_work_reschedule(&shadow_update_work,
      				K_SECONDS(CONFIG_AWS_IOT_SAMPLE_PUBLICATION_INTERVAL_SECONDS));
      }
      
      static void connect_work_fn(struct k_work *work)
      {
      	int err;
      
      	LOG_INF("Connecting to AWS IoT");
      
      	err = aws_iot_connect(NULL);
      	if (err) {
      		LOG_ERR("aws_iot_connect, error: %d", err);
      	}
      
      	LOG_INF("Next connection retry in %d seconds",
      		CONFIG_AWS_IOT_SAMPLE_CONNECTION_RETRY_TIMEOUT_SECONDS);
      
      	(void)k_work_reschedule(&connect_work,
      				K_SECONDS(CONFIG_AWS_IOT_SAMPLE_CONNECTION_RETRY_TIMEOUT_SECONDS));
      }
      
      /* Functions that are executed on specific connection-related events. */
      
      static void on_aws_iot_evt_connected(const struct aws_iot_evt *const evt)
      {
      	(void)k_work_cancel_delayable(&connect_work);
      
      	/* If persistent session is enabled, the AWS IoT library will not subscribe to any topics.
      	 * Topics from the last session will be used.
      	 */
      	if (evt->data.persistent_session) {
      		LOG_WRN("Persistent session is enabled, using subscriptions "
      			"from the previous session");
      	}
      
      	/* Mark image as working to avoid reverting to the former image after a reboot. */
      #if defined(CONFIG_BOOTLOADER_MCUBOOT)
      	boot_write_img_confirmed();
      #endif
      
      	/* Start sequential updates to AWS IoT. */
      	(void)k_work_reschedule(&shadow_update_work, K_NO_WAIT);
      }
      
      static void on_aws_iot_evt_disconnected(void)
      {
      	(void)k_work_cancel_delayable(&shadow_update_work);
      	(void)k_work_reschedule(&connect_work, K_SECONDS(5));
      }
      
      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");
      
      		err = conn_mgr_all_if_down(true);
      		if (err) {
      			LOG_ERR("conn_mgr_all_if_down, error: %d", err);
      			FATAL_ERROR();
      			return;
      		}
      
      		err = conn_mgr_all_if_up(true);
      		if (err) {
      			LOG_ERR("conn_mgr_all_if_up, error: %d", err);
      			FATAL_ERROR();
      			return;
      		}
      
      	} 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_WRN("Unexpected FOTA image type");
      	}
      }
      
      static void on_net_event_l4_connected(void)
      {
      	(void)k_work_reschedule(&connect_work, K_SECONDS(5));
      }
      
      static void on_net_event_l4_disconnected(void)
      {
      	(void)aws_iot_disconnect();
      	(void)k_work_cancel_delayable(&connect_work);
      	(void)k_work_cancel_delayable(&shadow_update_work);
      }
      
      /* Event handlers */
      
      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_READY:
      		LOG_INF("AWS_IOT_EVT_READY");
      		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");
      
      		LOG_INF("Received message: \"%.*s\" on topic: \"%.*s\"", evt->data.msg.len,
      									 evt->data.msg.ptr,
      									 evt->data.msg.topic.len,
      									 evt->data.msg.topic.str);
      		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);
      		break;
      	case AWS_IOT_EVT_FOTA_ERROR:
      		LOG_INF("AWS_IOT_EVT_FOTA_ERROR");
      		break;
      	default:
      		LOG_WRN("Unknown AWS IoT event type: %d", evt->type);
      		break;
      	}
      }
      
      static void l4_event_handler(struct net_mgmt_event_callback *cb,
      			     uint32_t event,
      			     struct net_if *iface)
      {
      	switch (event) {
      	case NET_EVENT_L4_CONNECTED:
      		LOG_INF("Network connectivity established");
      		on_net_event_l4_connected();
      		break;
      	case NET_EVENT_L4_DISCONNECTED:
      		LOG_INF("Network connectivity lost");
      		on_net_event_l4_disconnected();
      		break;
      	default:
      		/* Don't care */
      		return;
      	}
      }
      
      static void connectivity_event_handler(struct net_mgmt_event_callback *cb,
      				       uint32_t event,
      				       struct net_if *iface)
      {
      	if (event == NET_EVENT_CONN_IF_FATAL_ERROR) {
      		LOG_ERR("NET_EVENT_CONN_IF_FATAL_ERROR");
      		FATAL_ERROR();
      		return;
      	}
      }
      
      int main(void)
      {
      	LOG_INF("The AWS IoT sample started, version: %s", CONFIG_AWS_IOT_SAMPLE_APP_VERSION);
      
      	int err;
      
      	/* Setup handler for Zephyr NET Connection Manager events. */
      	net_mgmt_init_event_callback(&l4_cb, l4_event_handler, L4_EVENT_MASK);
      	net_mgmt_add_event_callback(&l4_cb);
      
      	/* Setup handler for Zephyr NET Connection Manager Connectivity layer. */
      	net_mgmt_init_event_callback(&conn_cb, connectivity_event_handler, CONN_LAYER_EVENT_MASK);
      	net_mgmt_add_event_callback(&conn_cb);
      
      	/* Connecting to the configured connectivity layer.
      	 * Wi-Fi or LTE depending on the board that the sample was built for.
      	 */
      	LOG_INF("Bringing network interface up and connecting to the network");
      
      	err = conn_mgr_all_if_up(true);
      	if (err) {
      		LOG_ERR("conn_mgr_all_if_up, error: %d", err);
      		FATAL_ERROR();
      		return err;
      	}
      
      	err = aws_iot_client_init();
      	if (err) {
      		LOG_ERR("aws_iot_client_init, error: %d", err);
      		FATAL_ERROR();
      		return err;
      	}
      
      	/* Resend connection status if the sample is built for QEMU x86.
      	 * This is necessary because the network interface is automatically brought up
      	 * at SYS_INIT() before main() is called.
      	 * This means that NET_EVENT_L4_CONNECTED fires before the
      	 * appropriate handler l4_event_handler() is registered.
      	 */
      	if (IS_ENABLED(CONFIG_BOARD_QEMU_X86)) {
      		conn_mgr_mon_resend_status();
      	}
      
      	return 0;
      }
      


    and prj.conf

    # Copyright (c) 2020 Nordic Semiconductor ASA
    #
    # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
    #
    
    # General
    CONFIG_LOG=y
    CONFIG_LOG_BUFFER_SIZE=2048
    CONFIG_HW_ID_LIBRARY=y
    CONFIG_ASSERT=y
    CONFIG_JSON_LIBRARY=y
    
    # Heap and stacks
    CONFIG_HEAP_MEM_POOL_SIZE=8192
    CONFIG_MAIN_STACK_SIZE=4096
    CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048
    
    # Network
    CONFIG_NETWORKING=y
    CONFIG_NET_NATIVE=y
    CONFIG_NET_IPV4=y
    CONFIG_NET_CONNECTION_MANAGER=y
    
    # AWS IoT library
    CONFIG_AWS_IOT_CLIENT_ID_MAX_LEN=50
    CONFIG_AWS_IOT=y
    CONFIG_AWS_IOT_CLIENT_ID_STATIC="iotconsole-0fa49f1f-46d5-4d99-8753-fe7983a9352f"
    CONFIG_AWS_IOT_BROKER_HOST_NAME="a3dnd3kgq72p80-ats.iot.us-east-2.amazonaws.com"
    CONFIG_AWS_IOT_SEC_TAG=78534251
    CONFIG_AWS_IOT_APP_SUBSCRIPTION_LIST_COUNT=2
    CONFIG_AWS_IOT_TOPIC_UPDATE_DELTA_SUBSCRIBE=y
    CONFIG_AWS_IOT_TOPIC_GET_ACCEPTED_SUBSCRIBE=y
    CONFIG_AWS_IOT_TOPIC_GET_REJECTED_SUBSCRIBE=y
    CONFIG_AWS_IOT_LAST_WILL=y
    
    # MQTT - Maximum MQTT keepalive timeout specified by AWS IoT Core
    CONFIG_MQTT_KEEPALIVE=1200
    CONFIG_MQTT_CLEAN_SESSION=y
    

    and additionally i added like this my certificates here is it right or wrong way.
    where could be the issue ?


    If sim not problem is it problem from certificate side or anything else?

  • Hi,
         when i tried to add my certificates now im facing this issue below image what i need to do?

  • Hi,

    Is your modem on (AT+CFUN=1)?

    Have you enabled AT Host Library using CONFIG_AT_HOST_LIBRARY=y as mentioned in the sample output?

    To get some error codes, you could open Serial Terminal and use AT+CMEE=1.

    Best regards,
    Dejan

  • Hi,

          Where can I access the application log after adding CONFIG_LTE_LINK_CONTROL_LOG_LEVEL_DBG=y to the configuration file?

    Should I check the cellular monitor to view the expected sample output?

    Do I need to insert CONFIG_AT_HOST_LIBRARY=y into the AWS IoT sample code, then flash it onto the device, and subsequently review the output through the cellular monitor? Or is there an alternative method to verify its activation?

    Can I follow the below link

     Introducing the Cellular Monitor 

    Or I can follow the cellular iot fundamental course 7th lesson?

  • Hi,

    purushothaman said:
    Where can I access the application log after adding CONFIG_LTE_LINK_CONTROL_LOG_LEVEL_DBG=y to the configuration file?

    Application log is obtained from serial UART. You can access it by using terminal emulator application as shown in the AWS IoT sample output.

    purushothaman said:
    Do I need to insert CONFIG_AT_HOST_LIBRARY=y into the AWS IoT sample code, then flash it onto the device, and subsequently review the output through the cellular monitor? Or is there an alternative method to verify its activation?

    You should add CONFIG_AT_HOST_LIBRARY=y to your project configuration file prj.conf. You can look at the output via Serial Terminal which you can start from Serial Monitor.

    purushothaman said:

    Can I follow the below link

     Introducing the Cellular Monitor 

    Or I can follow the cellular iot fundamental course 7th lesson?

    Both mentioned option can be followed, and if needed combined. You can also read about Cellular Monitor in the documentation.

    Best regards,
    Dejan

  • Hi,
          After adding my certificate into the LTE Link Monitor successfully without any errors.

    Following the integration process, I added the configuration "CONFIG_LTE_LINK_CONTROL_LOG_LEVEL_DBG=y" in the prj.config file. After that, I proceeded to build and flash the code onto my device. However, despite these steps, I am still experiencing difficulties with the establishment of the network.

    To troubleshoot this matter further, I am curious whether a board reset is necessary. Could you please advise on whether this step might resolve the issue?

     
        

    Additionally, I am utilizing the latest version of the SDK (2.6.0), and I am working with sample code provided therein. Would it be possible for you to share any functional code samples that could help in comparing against the provided sample code? This would greatly assist me in identifying any differences and resolving the issue effectively.

    Thank you for your attention to this matter. I look forward to your guidance and assistance in resolving this issue promptly.

Reply
  • Hi,
          After adding my certificate into the LTE Link Monitor successfully without any errors.

    Following the integration process, I added the configuration "CONFIG_LTE_LINK_CONTROL_LOG_LEVEL_DBG=y" in the prj.config file. After that, I proceeded to build and flash the code onto my device. However, despite these steps, I am still experiencing difficulties with the establishment of the network.

    To troubleshoot this matter further, I am curious whether a board reset is necessary. Could you please advise on whether this step might resolve the issue?

     
        

    Additionally, I am utilizing the latest version of the SDK (2.6.0), and I am working with sample code provided therein. Would it be possible for you to share any functional code samples that could help in comparing against the provided sample code? This would greatly assist me in identifying any differences and resolving the issue effectively.

    Thank you for your attention to this matter. I look forward to your guidance and assistance in resolving this issue promptly.

Children
  • Hi dejans,
                   Additionally, as I have seen in the NRF documentation, I learned that NRF Cloud was built on top of AWS Cloud. Consequently, I added the JSON certificate for NRF Cloud and I tested the asset tracking code.Based on this output, I believe that the device has successfully connected to the NRF Cloud (AWS). However, I would greatly appreciate it if you could confirm this for me.



     However, I am facing challenges when attempting to connect using the simple sample AWS IoT Cloud code. Could you shed some light on why this might be the case?

  • Hi
        

    I noticed that in the NRF Cloud multiservice sample code in VS code, they use the same "l4_event_handler()" function as in the AWS IoT sample code. But while the device connects successfully to network establishment with this function, it struggles to connect to AWS Cloud code network establishment and further cloud functions. Can you help me understand why?

    Also, I'm curious about something. In the NRF Cloud multiservice code, the device connects to the cloud without us adding any NRF Cloud-related certificates before flashing. How does this work? On the other hand, for AWS Cloud, we need to add an endpoint, client ID, and security tag. But I don't see these in the NRF Cloud multiservice code, yet it still connects. Can you explain this to me?

    Your explanation would really help me figure out why we're having trouble with AWS Cloud and how NRF Cloud connects differently.

    Thanks for your help.

  • Hi,

    Could you provide complete application logs when you used asset_tracker_v2 and nRF Cloud multi-service samples?

    Best regards,
    Dejan

  • Hi,
    Application log means the below one right? I have attached the output of the nRf cloud multi-service code here."

         

    *** Booting nRF Connect SDK d96769faceca ***
    [00:00:00.254,364] <err> spi_nor: Device id 00 00 00 does not match config c2 28 17
    *** Booting nRF Connect SDK d96769faceca ***
    [00:00:00.255,523] <inf> main: nRF Cloud multi-service sample has started, version: 1.0.0, protocol: MQTT
    [00:00:00.255,584] <inf> cloud_connection: Enabling connectivity...
    [00:00:00.533,569] <inf> cloud_connection: Setting up nRF Cloud library...
    [00:00:00.535,430] <inf> cloud_connection: Waiting for network ready...
    +CEREG: 2,"4006","034A1710",7
    +CSCON: 1
    +CGEV: ME PDN ACT 0,0
    +CNEC_ESM: 50,0
    +CEREG: 1,"4006","034A1710",7,,,"00001010","11100000"
    [00:00:03.597,351] <inf> cloud_connection: Network connectivity gained!
    %XTIME: "0A","4240506005310A","01"
    [00:00:04.597,503] <inf> cloud_connection: Network is ready
    [00:00:04.597,534] <inf> cloud_connection: Connecting to nRF Cloud
    [00:00:04.597,595] <inf> cloud_connection: Device ID: nrf-351516172687873
    [00:00:07.359,497] <inf> cloud_connection: Connected to nRF Cloud
    [00:00:08.704,681] <inf> application: Waiting for modem to determine current date and time
    [00:00:08.704,711] <inf> application: Current date and time determined
    [00:00:08.715,576] <inf> application: Temperature is 23 degrees C
    [00:00:08.716,461] <inf> nrf_cloud_pgps: Storage base:0xEB000, size:86016
    [00:00:08.717,895] <inf> nrf_cloud_pgps: Checking P-GPS header: Schema version:0, type:0, num:0, count:0
    [00:00:08.717,926] <inf> nrf_cloud_pgps:   size:0, period (minutes):0, GPS day:0, GPS time:0
    [00:00:08.717,926] <wrn> nrf_cloud_pgps: One or more fields are wrong
    [00:00:08.720,458] <inf> nrf_cloud_pgps: Requesting 42 predictions...
    [00:00:08.756,988] <inf> nrf_cloud_pgps: Searching for prediction
    [00:00:08.756,988] <inf> nrf_cloud_pgps: Predictions not loaded yet
    [00:00:09.515,106] <inf> nrf_cloud_pgps: Searching for prediction
    [00:00:09.515,136] <inf> nrf_cloud_pgps: Predictions not loaded yet
    [00:00:11.501,434] <inf> download_client: Downloading: public/16161-28800_16168-14400.bin [0]
    [00:00:11.693,969] <inf> download_client: Setting up TLS credentials, sec tag count 1
    [00:00:11.694,091] <inf> download_client: Connecting to 99.84.203.21
    [00:00:13.654,693] <inf> download_client: Downloaded 1500/84268 bytes (1%)
    [00:00:13.654,754] <inf> nrf_cloud_pgps: Checking P-GPS header: Schema version:1, type:10, num:1, count:42
    [00:00:13.654,785] <inf> nrf_cloud_pgps:   size:2006, period (minutes):240, GPS day:16161, GPS time:28800
    [00:00:13.654,815] <inf> nrf_cloud_pgps: pgps_header: Schema version:1, type:10, num:1, count:42
    [00:00:13.654,846] <inf> nrf_cloud_pgps:   size:2006, period (minutes):240, GPS day:16161, GPS time:28800
    [00:00:13.910,644] <inf> download_client: Downloaded 3000/84268 bytes (3%)
    [00:00:13.910,736] <inf> nrf_cloud_pgps: Storing prediction num:0 idx:0 for gps sec:1396339200
    [00:00:14.133,575] <inf> download_client: Downloaded 4500/84268 bytes (5%)
    [00:00:14.133,728] <inf> nrf_cloud_pgps: Storing prediction num:1 idx:1 for gps sec:1396353600
    [00:00:14.265,045] <inf> nrf_cloud_pgps: Searching for prediction
    [00:00:14.265,197] <inf> nrf_cloud_pgps: GPS unit needs ephemerides. Injecting 32.
    [00:00:14.576,568] <inf> download_client: Downloaded 6000/84268 bytes (7%)
    [00:00:14.773,590] <inf> download_client: Downloaded 7500/84268 bytes (8%)
    [00:00:14.773,651] <inf> nrf_cloud_pgps: Storing prediction num:2 idx:2 for gps sec:1396368000
    [00:00:15.013,610] <inf> download_client: Downloaded 9000/84268 bytes (10%)
    [00:00:15.013,702] <inf> nrf_cloud_pgps: Storing prediction num:3 idx:3 for gps sec:1396382400
    [00:00:15.413,635] <inf> download_client: Downloaded 10500/84268 bytes (12%)
    [00:00:15.413,787] <inf> nrf_cloud_pgps: Storing prediction num:4 idx:4 for gps sec:1396396800
    [00:00:15.653,656] <inf> download_client: Downloaded 12000/84268 bytes (14%)
    [00:00:15.893,646] <inf> download_client: Downloaded 13500/84268 bytes (16%)
    [00:00:15.893,707] <inf> nrf_cloud_pgps: Storing prediction num:5 idx:5 for gps sec:1396411200
    [00:00:16.293,670] <inf> download_client: Downloaded 15000/84268 bytes (17%)
    [00:00:16.293,762] <inf> nrf_cloud_pgps: Storing prediction num:6 idx:6 for gps sec:1396425600
    [00:00:16.544,647] <inf> download_client: Downloaded 16500/84268 bytes (19%)
    [00:00:16.544,799] <inf> nrf_cloud_pgps: Storing prediction num:7 idx:7 for gps sec:1396440000
    [00:00:16.939,697] <inf> download_client: Downloaded 18000/84268 bytes (21%)
    [00:00:17.184,692] <inf> download_client: Downloaded 19500/84268 bytes (23%)
    [00:00:17.184,753] <inf> nrf_cloud_pgps: Storing prediction num:8 idx:8 for gps sec:1396454400
    [00:00:17.413,726] <inf> download_client: Downloaded 21000/84268 bytes (24%)
    [00:00:17.413,818] <inf> nrf_cloud_pgps: Storing prediction num:9 idx:9 for gps sec:1396468800
    [00:00:17.814,727] <inf> download_client: Downloaded 22500/84268 bytes (26%)
    [00:00:17.814,880] <inf> nrf_cloud_pgps: Storing prediction num:10 idx:10 for gps sec:1396483200
    [00:00:18.063,720] <inf> download_client: Downloaded 24000/84268 bytes (28%)
    [00:00:18.301,788] <inf> download_client: Downloaded 25500/84268 bytes (30%)
    [00:00:18.301,849] <inf> nrf_cloud_pgps: Storing prediction num:11 idx:11 for gps sec:1396497600
    [00:00:18.694,763] <inf> download_client: Downloaded 27000/84268 bytes (32%)
    [00:00:18.694,885] <inf> nrf_cloud_pgps: Storing prediction num:12 idx:12 for gps sec:1396512000
    [00:00:18.939,758] <inf> download_client: Downloaded 28500/84268 bytes (33%)
    [00:00:18.939,910] <inf> nrf_cloud_pgps: Storing prediction num:13 idx:13 for gps sec:1396526400
    [00:00:19.334,777] <inf> download_client: Downloaded 30000/84268 bytes (35%)
    [00:00:19.573,791] <inf> download_client: Downloaded 31500/84268 bytes (37%)
    [00:00:19.573,883] <inf> nrf_cloud_pgps: Storing prediction num:14 idx:14 for gps sec:1396540800
    [00:00:19.813,812] <inf> download_client: Downloaded 33000/84268 bytes (39%)
    [00:00:19.813,934] <inf> nrf_cloud_pgps: Storing prediction num:15 idx:15 for gps sec:1396555200
    [00:00:20.214,843] <inf> download_client: Downloaded 34500/84268 bytes (40%)
    [00:00:20.214,996] <inf> nrf_cloud_pgps: Storing prediction num:16 idx:16 for gps sec:1396569600
    [00:00:20.453,857] <inf> download_client: Downloaded 36000/84268 bytes (42%)
    [00:00:20.693,847] <inf> download_client: Downloaded 37500/84268 bytes (44%)
    [00:00:20.693,908] <inf> nrf_cloud_pgps: Storing prediction num:17 idx:17 for gps sec:1396584000
    [00:00:21.124,847] <inf> download_client: Downloaded 39000/84268 bytes (46%)
    [00:00:21.124,969] <inf> nrf_cloud_pgps: Storing prediction num:18 idx:18 for gps sec:1396598400
    [00:00:21.333,892] <inf> download_client: Downloaded 40500/84268 bytes (48%)
    [00:00:21.334,045] <inf> nrf_cloud_pgps: Storing prediction num:19 idx:19 for gps sec:1396612800
    [00:00:21.764,892] <inf> download_client: Downloaded 42000/84268 bytes (49%)
    [00:00:21.973,907] <inf> download_client: Downloaded 43500/84268 bytes (51%)
    [00:00:21.973,968] <inf> nrf_cloud_pgps: Storing prediction num:20 idx:20 for gps sec:1396627200
    [00:00:22.213,928] <inf> download_client: Downloaded 45000/84268 bytes (53%)
    [00:00:22.214,019] <inf> nrf_cloud_pgps: Storing prediction num:21 idx:21 for gps sec:1396641600
    [00:00:22.614,929] <inf> download_client: Downloaded 46500/84268 bytes (55%)
    [00:00:22.615,081] <inf> nrf_cloud_pgps: Storing prediction num:22 idx:22 for gps sec:1396656000
    [00:00:22.853,942] <inf> download_client: Downloaded 48000/84268 bytes (56%)
    [00:00:23.093,963] <inf> download_client: Downloaded 49500/84268 bytes (58%)
    [00:00:23.094,024] <inf> nrf_cloud_pgps: Storing prediction num:23 idx:23 for gps sec:1396670400
    [00:00:23.494,964] <inf> download_client: Downloaded 51000/84268 bytes (60%)
    [00:00:23.495,086] <inf> nrf_cloud_pgps: Storing prediction num:24 idx:24 for gps sec:1396684800
    [00:00:23.733,978] <inf> download_client: Downloaded 52500/84268 bytes (62%)
    [00:00:23.734,161] <inf> nrf_cloud_pgps: Storing prediction num:25 idx:25 for gps sec:1396699200
    [00:00:24.177,001] <inf> download_client: Downloaded 54000/84268 bytes (64%)
    [00:00:24.374,023] <inf> download_client: Downloaded 55500/84268 bytes (65%)
    [00:00:24.374,084] <inf> nrf_cloud_pgps: Storing prediction num:26 idx:26 for gps sec:1396713600
    [00:00:24.614,013] <inf> download_client: Downloaded 57000/84268 bytes (67%)
    [00:00:24.614,135] <inf> nrf_cloud_pgps: Storing prediction num:27 idx:27 for gps sec:1396728000
    [00:00:25.014,038] <inf> download_client: Downloaded 58500/84268 bytes (69%)
    [00:00:25.014,221] <inf> nrf_cloud_pgps: Storing prediction num:28 idx:28 for gps sec:1396742400
    [00:00:25.254,058] <inf> download_client: Downloaded 60000/84268 bytes (71%)
    [00:00:25.505,035] <inf> download_client: Downloaded 61500/84268 bytes (72%)
    [00:00:25.505,126] <inf> nrf_cloud_pgps: Storing prediction num:29 idx:29 for gps sec:1396756800
    [00:00:25.895,080] <inf> download_client: Downloaded 63000/84268 bytes (74%)
    [00:00:25.895,202] <inf> nrf_cloud_pgps: Storing prediction num:30 idx:30 for gps sec:1396771200
    [00:00:26.134,155] <inf> download_client: Downloaded 64500/84268 bytes (76%)
    [00:00:26.134,338] <inf> nrf_cloud_pgps: Storing prediction num:31 idx:31 for gps sec:1396785600
    [00:00:26.535,064] <inf> download_client: Downloaded 66000/84268 bytes (78%)
    [00:00:26.794,128] <inf> download_client: Downloaded 67500/84268 bytes (80%)
    [00:00:26.794,189] <inf> nrf_cloud_pgps: Storing prediction num:32 idx:32 for gps sec:1396800000
    [00:00:27.015,106] <inf> download_client: Downloaded 69000/84268 bytes (81%)
    [00:00:27.015,228] <inf> nrf_cloud_pgps: Storing prediction num:33 idx:33 for gps sec:1396814400
    [00:00:27.425,140] <inf> download_client: Downloaded 70500/84268 bytes (83%)
    [00:00:27.425,292] <inf> nrf_cloud_pgps: Storing prediction num:34 idx:34 for gps sec:1396828800
    [00:00:27.654,144] <inf> download_client: Downloaded 72000/84268 bytes (85%)
    [00:00:27.894,165] <inf> download_client: Downloaded 73500/84268 bytes (87%)
    [00:00:27.894,226] <inf> nrf_cloud_pgps: Storing prediction num:35 idx:35 for gps sec:1396843200
    [00:00:28.294,189] <inf> download_client: Downloaded 75000/84268 bytes (89%)
    [00:00:28.294,311] <inf> nrf_cloud_pgps: Storing prediction num:36 idx:36 for gps sec:1396857600
    [00:00:28.534,179] <inf> download_client: Downloaded 76500/84268 bytes (90%)
    [00:00:28.534,362] <inf> nrf_cloud_pgps: Storing prediction num:37 idx:37 for gps sec:1396872000
    [00:00:28.941,070] <inf> download_client: Downloaded 78000/84268 bytes (92%)
    [00:00:29.174,224] <inf> download_client: Downloaded 79500/84268 bytes (94%)
    [00:00:29.174,285] <inf> nrf_cloud_pgps: Storing prediction num:38 idx:38 for gps sec:1396886400
    [00:00:29.424,224] <inf> download_client: Downloaded 81000/84268 bytes (96%)
    [00:00:29.424,346] <inf> nrf_cloud_pgps: Storing prediction num:39 idx:39 for gps sec:1396900800
    [00:00:29.814,239] <inf> download_client: Downloaded 82500/84268 bytes (97%)
    [00:00:29.814,422] <inf> nrf_cloud_pgps: Storing prediction num:40 idx:40 for gps sec:1396915200
    [00:00:30.094,268] <inf> download_client: Downloaded 84000/84268 bytes (99%)
    [00:00:30.244,506] <inf> download_client: Downloaded 84268/84268 bytes (100%)
    [00:00:30.244,567] <inf> nrf_cloud_pgps: Storing prediction num:41 idx:41 for gps sec:1396929600
    [00:00:30.375,885] <inf> nrf_cloud_pgps: All P-GPS data received. Done.
    [00:00:30.375,946] <inf> nrf_cloud_pgps: Searching for prediction
    [00:00:30.376,037] <inf> nrf_cloud_pgps: GPS unit needs ephemerides. Injecting 32.
    [00:00:30.376,220] <inf> download_client: Download complete
    [00:00:30.376,251] <inf> nrf_cloud_pgps: Download client done
    +CSCON: 0
    [00:00:48.764,373] <inf> location: Method specific timeout expired
    [00:00:48.773,345] <inf> location: Location retrieval failed using 'GNSS', trying with 'Cellular' next
    %NCELLMEAS: 0,"034A1710","310410","4006",30,5110,49,72,29,51165,32224
    %NCELLMEAS: 0,"034A1710","310410","4006",30,32224,5110,49,72,29,51165,1,0,"0052A40C","310260","A2E3",65535,0,1026,22,33,15,51267,0,0
    %NCELLMEAS: 0,"034A1710","310410","4006",30,32224,5110,49,72,30,52445,1,0,"0052A40C","310260","A2E3",65535,0,1026,22,33,16,53126,0,0,"02982901","311580","1101",65535,0,5035,354,59,11,53135,0,0,"0328CB03","311480","CF03",65535,0,5230,146,48,25,53192,0,0
    +CSCON: 1
    [00:00:54.633,483] <inf> location: LOCATION_REQ_MODE_ALL: all methods done
    [00:00:54.633,544] <inf> application: Location Updated: 40.787126 N -89.609529 W, accuracy: 390.0 m, Method: Cellular
    +CSCON: 0
    [00:01:08.715,637] <inf> application: Temperature is 22 degrees C
    +CSCON: 1
    +CSCON: 0
    [00:02:08.715,698] <inf> application: Temperature is 22 degrees C
    +CSCON: 1
    +CSCON: 0
    [00:02:34.654,785] <inf> location: Method specific timeout expired

    and here I attached the open log file option in serial terminal here
    2024-04-05T06:54:52.493Z INFO Initialising nrfutil module: device
    2024-04-05T06:54:52.519Z DEBUG Application data folder: C:\Users\pmariyappan\AppData\Roaming\nrfconnect\pc-nrfconnect-serial-terminal
    2024-04-05T06:54:52.562Z DEBUG Sending event "serial-terminal: running nrfutil device"
    2024-04-05T06:54:52.562Z DEBUG App pc-nrfconnect-serial-terminal v1.3.1 (official)
    2024-04-05T06:54:52.562Z DEBUG App path: C:\Users\pmariyappan\.nrfconnect-apps\node_modules\pc-nrfconnect-serial-terminal
    2024-04-05T06:54:52.562Z DEBUG nRFConnect 4.4.1, required by the app is (>=4.4.1)
    2024-04-05T06:54:52.562Z DEBUG nRFConnect path: C:\Users\pmariyappan\AppData\Local\Programs\nrfconnect\resources\app.asar
    2024-04-05T06:54:52.562Z DEBUG HomeDir: C:\Users\pmariyappan
    2024-04-05T06:54:52.562Z DEBUG TmpDir: C:\Users\PMARIY~1\AppData\Local\Temp
    2024-04-05T06:54:53.485Z DEBUG Sending event "serial-terminal: running nrfutil device"
    2024-04-05T06:54:55.251Z DEBUG Sending event "serial-terminal: running nrfutil device"
    2024-04-05T06:54:55.251Z DEBUG Sending event "serial-terminal: running nrfutil device"
    2024-04-05T06:54:55.255Z DEBUG Sending event "serial-terminal: running nrfutil device"
    2024-04-05T06:54:55.348Z INFO Using nrfutil-device core version: 7.7.1
    2024-04-05T06:54:55.937Z INFO Using nrfutil-device version: 2.1.1
    2024-04-05T06:54:55.937Z INFO Using nrf-device-lib version: 0.17.5
    2024-04-05T06:54:55.937Z INFO Using nrfjprog DLL version: 10.24.0
    2024-04-05T06:54:55.937Z INFO Using JLink version: JLink_V7.88j
    2024-04-05T06:54:55.937Z WARN Installed JLink version does not match the expected version (JLink_V7.94e)
    2024-04-05T06:54:56.104Z INFO Device Connected SN:000960098217
    2024-04-05T06:54:56.104Z INFO Getting serialport options from persistent store 000960098217.pc-nrfconnect-serial-terminal
    2024-04-05T06:54:56.105Z DEBUG Sending event "serial-terminal: device connected"
    2024-04-05T06:54:57.815Z DEBUG Sending event "serial-terminal: running nrfutil device"
    2024-04-05T06:54:59.234Z INFO Selected device with s/n 000960098217
    2024-04-05T06:54:59.236Z DEBUG Sending event "serial-terminal: device selected"
    2024-04-05T06:54:59.243Z INFO Opened port with options: {"baudRate":115200,"path":"COM4"}
    2024-04-05T06:54:59.255Z INFO Get terminal settings from persistent store 000960098217.vCom-0.TerminalSettings
    2024-04-05T06:55:34.070Z DEBUG The app will need to read the content of C:\Users\pmariyappan\AppData\Roaming\nrfconnect\pc-nrfconnect-serial-terminal\.history, becuase it may not be in-sync with the (in-memory) history buffer.
    2024-04-05T06:56:06.610Z DEBUG The app will need to read the content of C:\Users\pmariyappan\AppData\Roaming\nrfconnect\pc-nrfconnect-serial-terminal\.history, becuase it may not be in-sync with the (in-memory) history buffer.
    2024-04-05T06:56:21.345Z DEBUG The app will need to read the content of C:\Users\pmariyappan\AppData\Roaming\nrfconnect\pc-nrfconnect-serial-terminal\.history, becuase it may not be in-sync with the (in-memory) history buffer.
    2024-04-05T06:57:26.729Z DEBUG The app will need to read the content of C:\Users\pmariyappan\AppData\Roaming\nrfconnect\pc-nrfconnect-serial-terminal\.history, becuase it may not be in-sync with the (in-memory) history buffer.
    
    Can you please identify the issue? Recently, I followed the document 'nRF91: keys generated on device' method to successfully generate certificates. Additionally, I modified the CONFIG_AWS_IOT_CLIENT_ID_STATIC to  match the Thing Name "THING9160_DK" I created with the policy, which was a mistake in my previous project configuration mentioned above. I also added the correct security tag and hostname. However, the output remains the same, and nothing has changed.

  • Hi,

    Could you provide application log when you use asset_tracker_v2 sample?

    Regarding aws_iot, have you created aws_iot policy and configured it correctly? Have you checked that all steps shown in aws_iot configuration are completed correctly?

    Best regards,
    Dejan

Related