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.

  • 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