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


    and prj.conf


    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,

    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."

         


    and here I attached the open log file option in serial terminal here
    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

  • Hi,
        

    I've recently updated my SDK version to 2.6.0, and since then, I've encountered issues flashing only the asset tracking code. I've already raised a support ticket regarding this matter.

    Regarding the AWS IoT configuration, yes, I've created the necessary policy and attached it while creating the certificate, following the instructions provided in SDK version 2.6.0. I have also set up the policy as mentioned in the document.I followed like this below pic

    However, there's some confusion regarding setting the client ID and host name at runtime. Is it essential to set the client ID at runtime? If so, here's my understanding: Setting the client ID and host name at runtime means configuring the options in the project configuration, specifically CONFIG_AWS_IOT_BROKER_HOST_NAME="xxxxxxxxxxx80-ats.iot.us-east-2.amazonaws.com" and CONFIG_AWS_IOT_CLIENT_ID_STATIC="THING9160_DK". Would this configuration effectively set the endpoint at runtime?

    I've noticed discrepancies between the documentation for SDK version 2.4.0 and the instructions provided for SDK version 2.6.0. In version 2.4.0, there are explicit options like CONFIG_AWS_IOT_BROKER_HOST_NAME_APP and CONFIG_AWS_IOT_CLIENT_ID_APP. However, in the newer version, there's no mention of these options. Instead, the documentation suggests setting these parameters at runtime using the aws_iot_connect() function.

    Here's what the documentation states in SDK 2.6.0:

    • Setting client ID at runtime: The library supports passing in the client ID at runtime by setting the client_id entry in the aws_iot_config structure passed into the aws_iot_connect() function. The client_id entry must be a null-terminated string.

    • Setting the AWS host name at runtime: Similarly, the library supports passing in the endpoint URL at runtime by setting the host_name entry in the aws_iot_config structure passed into the aws_iot_connect() function.

      However, despite following these instructions, I encountered errors. If I include CONFIG_AWS_IOT_BROKER_HOST_NAME_APP and CONFIG_AWS_IOT_CLIENT_ID_APP into my new SDK version 2.6.0 AWS IoT sample, it throws errors. Could you please clarify how to correctly implement these runtime configurations? Should I still adhere to the older approach of setting CONFIG_AWS_IOT_BROKER_HOST_NAME_APP and CONFIG_AWS_IOT_CLIENT_ID_APP?, or is there a different procedure for SDK version 2.6.0? If possible, could you provide guidance or examples on how to correctly set these parameters at runtime within the aws_iot_connect() function?I have attach the code aws_iot_connect() below.do i need to do anything here.


      aws_iot_config structure

    I appreciate your assistance in resolving this matter.

  • Hi,

    There are 2 options in NCS v2.6.0 for setting mentioned configuration. 
    First is to configure relevant parameters - CONFIG_AWS_IOT_BROKER_HOST_NAME and CONFIG_AWS_IOT_CLIENT_ID_STATIC - in prj.conf which are going to be used during building process. If you want to use mentioned Kconfig options, NULL should be passed as an argument to aws_iot_connect(), aws_iot_connect(NULL). 
    Another option is to use struct aws_iot_config where you can specify your connection options client_id and host_name inside the structure. For example, you can look at the function aws_iot_integration in the asset_tracker_v2 sample or in the relevant part of main.c in the aws_iot sample.

    Best regards,
    Dejan

Reply
  • Hi,

    There are 2 options in NCS v2.6.0 for setting mentioned configuration. 
    First is to configure relevant parameters - CONFIG_AWS_IOT_BROKER_HOST_NAME and CONFIG_AWS_IOT_CLIENT_ID_STATIC - in prj.conf which are going to be used during building process. If you want to use mentioned Kconfig options, NULL should be passed as an argument to aws_iot_connect(), aws_iot_connect(NULL). 
    Another option is to use struct aws_iot_config where you can specify your connection options client_id and host_name inside the structure. For example, you can look at the function aws_iot_integration in the asset_tracker_v2 sample or in the relevant part of main.c in the aws_iot sample.

    Best regards,
    Dejan

Children
  • Hi,
        

    I have followed the instructions provided by you for configuring the AWS IoT connection in two different ways, but I am still facing difficulties.

    Here is a summary of what I have done:

    Option 1: I have followed the first option, where I pass NULL as an argument to the aws_iot_connect()function.


    Option 2: I have also tried the second option, where I use the struct aws_iot_config structure to specify connection options.


    In addition, I have configured the CONFIG_AWS_IOT_CLIENT_ID_STATIC and CONFIG_AWS_IOT_BROKER_HOST_NAME options in my prj.conf file as instructed.

    However, despite following these steps, I am still unable to establish a connection to AWS IoT. I am only getting output for the two lines mentioned in the screenshot below.

    Could you please review my setup and provide any guidance or suggestions on what might be causing this issue? I would greatly appreciate any assistance you can provide to help resolve this matter.

    Thank you for your attention to this request. Looking forward to your response.

  • Hi,    

     Even if I open another new sample code of AWS IoT and do not make any changes, including not adding any certificate details, I will still get only these two lines of output shared in my above screenshot .

  • Hi, 

    Did you get any additional information when you added CONFIG_LTE_LINK_CONTROL_LOG_LEVEL_DBG=y to your prj.conf file?

    Regarding your connectivity issue, did you get any errors in your logs so far?

    It looks like you are not able to connect to the network. In order to determine possible cause, could you provide a modem trace?
    For capturing traces, you can use Cellular Monitor. You would need to prepare device before capturing modem trace.

    Best regards,
    Dejan

  • Hi,

     

    Thank you for your response.

    Even after adding CONFIG_LTE_LINK_CONTROL_LOG_LEVEL_DBG=y to the prj.conf file, I didn't receive any additional information. Unfortunately, I encountered errors when attempting to troubleshoot by adding CONFIG_NRF_MODEM_LIB_TRACE to the project configuration. Therefore, I am unable to provide the modem trace file at this time.

    However, during debugging, I encountered an issue with the following if condition:

    //if (IS_ENABLED(CONFIG_BOARD_QEMU_X86) || IS_ENABLED(CONFIG_BOARD_NATIVE_SIM)) {
    conn_mgr_mon_resend_status();
    //}

    To proceed, I commented out this if condition. Subsequently, I encountered errors similar to those shown in the screenshot.



    Given this situation, could you please advise on the next steps? Your guidance on resolving these errors and determining the root cause of the connectivity issue would be greatly appreciated.

    Thank you for your assistance.

  • Hi,

    Which board did you build for? What was your build target? Could you provide your build command?

    Best regards,
    Dejan