Uploading Environmental Data to nRF Cloud

Hi, 

I am trying to upload data from two sensors, the BME280 and APDS9960, to the nRF Cloud. I have been able to extract data from the sensors with I2C, but it seems I am getting an error when trying to connect to the nRF Cloud. It is regarding the funcion `lte_lc_init_and_connect'. 

I am coding on VSCode with the latest extension, v2.9.0 on Windows 10. I am still a novice with this, so any help would be appreciated. 

I am attaching photos of my code and errors. 

Parents
  • Hi,

    Which device do you use?

    Do you use any of our samples as basis for your application and for your testing?

    Can you show your build command and provide complete build log? You could upload your build log by first making zip file and then clicking on Insert -> Image/video/file -> Upload.

    Best regards,
    Dejan

  • It seems I forgot to mention that it is the nRF9161DK. My bad. 

    My build configuration is the following. 

    Build Command:

    west build --build-dir --pristine --board nrf9161dk/nrf9161/ns -- -DNCS_TOOLCHAIN_VERSION=NONE -DBOARD_ROOT=c:\Users\RS_G\workspace\cloud-test

    Build LOG: 

    3240.build.rar

  • Hi, 

    I can look again later today. This is not based on any official Nordic example, just examples found online elsewhere using Zephyr API for the sensors. If there are any good recommendations, I can take a look. 

  • Hi,

    You can start by looking at Getting Started with nRF Cloud and then you can look at cellular samples in the documentation.

    Best regards,
    Dejan

  • Hi. 

    I have been working on the code for a while and was reading documentation on the CONFIG_NRF_CLOUD or nRF Cloud API as a way to send my data to the cloud. However, I noticed that the library does not appear for me and saying 'undefined symbol'. I am not sure why the SDK does not see the library. I am on the latest toolchain v2.9.1. 

    If I remove the config and let the code run, I am returned an error. I have tried checking ID, and updating to no avail. 

    [00:00:26.785,369] <err> main: Failed to initialize nRF Cloud library: -22
    [00:00:26.785,369] <err> main: Invalid argument - check client ID or Kconfig

    Thanks,

    Ryan

  • Hi Ryan,

    Which application sample did you use as basis for your application?

    Regarding inability to use CONFIG_NRF_CLOUD, I can see that this option is not used in NCS v2.9.0 (in nRF Cloud multi service sample) but it is used in main. Can you try to use main instead of NCS v2.9.0? What is the result?

    Best regards,
    Dejan

  • Hi, I based this code off the nrf_cloud_rest_device_message and the nrf_cloud_multi_service codes. I changed to main and now the CONFIG works, however I still have the same error without changing the code. So it was not the CONFIG but possible credential issue. 

    [00:00:00.678,222] <inf> main: Modem library initialized
    [00:00:00.678,222] <inf> main: Waiting for network...
    [00:00:03.021,179] <inf> main: Network registration status: 2
    [00:00:03.021,209] <inf> main: Network not registered or searching...
    [00:00:03.021,209] <inf> main: Cell update: Cell ID 12768004
    [00:00:03.021,240] <inf> main: LTE mode update: 7
    [00:00:03.071,319] <inf> main: Unhandled LTE event: 3
    [00:00:07.524,322] <inf> main: Network registration status: 5
    [00:00:07.524,353] <inf> main: Connected to roaming network
    [00:00:07.524,444] <inf> main: Connected to LTE
    [00:00:07.524,932] <inf> main: Device ID: nrf-358299840048751 (length: 19)
    [00:00:07.524,932] <inf> main: Attempting initial nRF Cloud connection...
    [00:00:07.524,963] <err> main: Failed to initialize nRF Cloud library: -22
    [00:00:07.524,963] <err> main: Invalid argument - check client ID or Kconfig
    [00:00:07.524,963] <err> main: Connection set-up failed.
    [00:00:07.524,963] <err> main: Setup failed, stopping.
    [00:00:07.649,780] <inf> nrf_cloud_credentials: Sec Tag: 16842753; CA: Yes, Client Cert: Yes, Private Key: Yes
    [00:00:07.649,841] <inf> nrf_cloud_credentials: CA Size: 1188, AWS: Likely, CoAP: Unlikely
    [00:00:07.649,841] <inf> main: Checking credentials in sec tag 16842753
    [00:00:07.649,841] <inf> main: Starting nRF9161 Sensor Cloud Application
    [00:00:07.936,309] <inf> main: Temp: 0.000000°C, Humidity: 0.000000%, Light: 109.000000 lux

    Thanks,

    Ryan

Reply
  • Hi, I based this code off the nrf_cloud_rest_device_message and the nrf_cloud_multi_service codes. I changed to main and now the CONFIG works, however I still have the same error without changing the code. So it was not the CONFIG but possible credential issue. 

    [00:00:00.678,222] <inf> main: Modem library initialized
    [00:00:00.678,222] <inf> main: Waiting for network...
    [00:00:03.021,179] <inf> main: Network registration status: 2
    [00:00:03.021,209] <inf> main: Network not registered or searching...
    [00:00:03.021,209] <inf> main: Cell update: Cell ID 12768004
    [00:00:03.021,240] <inf> main: LTE mode update: 7
    [00:00:03.071,319] <inf> main: Unhandled LTE event: 3
    [00:00:07.524,322] <inf> main: Network registration status: 5
    [00:00:07.524,353] <inf> main: Connected to roaming network
    [00:00:07.524,444] <inf> main: Connected to LTE
    [00:00:07.524,932] <inf> main: Device ID: nrf-358299840048751 (length: 19)
    [00:00:07.524,932] <inf> main: Attempting initial nRF Cloud connection...
    [00:00:07.524,963] <err> main: Failed to initialize nRF Cloud library: -22
    [00:00:07.524,963] <err> main: Invalid argument - check client ID or Kconfig
    [00:00:07.524,963] <err> main: Connection set-up failed.
    [00:00:07.524,963] <err> main: Setup failed, stopping.
    [00:00:07.649,780] <inf> nrf_cloud_credentials: Sec Tag: 16842753; CA: Yes, Client Cert: Yes, Private Key: Yes
    [00:00:07.649,841] <inf> nrf_cloud_credentials: CA Size: 1188, AWS: Likely, CoAP: Unlikely
    [00:00:07.649,841] <inf> main: Checking credentials in sec tag 16842753
    [00:00:07.649,841] <inf> main: Starting nRF9161 Sensor Cloud Application
    [00:00:07.936,309] <inf> main: Temp: 0.000000°C, Humidity: 0.000000%, Light: 109.000000 lux

    Thanks,

    Ryan

Children
  • Hi Ryan,

    Which device do you use for testing?

    Do you get the same error when you use separately unmodified nrf_cloud_rest_device_message and nrf_cloud_multi_service samples?

    How did you provision (and onboard) your device?

    Best regards,
    Dejan

  • Hi, 

    I am using the nRF9161DK.

    I have resolved the previous issue. However, now the code does not hold a connection to the Cloud. It temporarily connects at the beginning. I will read through more of the sample code to fix the issue hopefully. 

    [00:00:00.685,363] <inf> main: Modem library initialized
    [00:00:00.685,363] <inf> main: Waiting for network...
    [00:00:00.731,292] <err> main: Failed to get initial modem info: -22
    [00:00:03.428,833] <inf> main: Network registration status: 2
    [00:00:03.428,863] <inf> main: Network not registered or searching...
    [00:00:03.428,894] <inf> main: Cell update: Cell ID 12768004
    [00:00:03.428,894] <inf> main: LTE mode update: 7
    [00:00:03.598,937] <inf> main: Unhandled LTE event: 3
    [00:00:06.010,833] <inf> main: Network registration status: 5
    [00:00:06.010,894] <inf> main: Connected to roaming network
    [00:00:06.010,955] <inf> main: Connected to LTE
    [00:00:06.011,444] <inf> main: Device ID: nrf-358299840048751 (length: 19)
    [00:00:06.011,474] <inf> main: Attempting initial nRF Cloud connection...
    [00:00:06.011,779] <wrn> nrf_cloud_transport: Not configured for runtime client ID, ignoring
    [00:00:06.012,084] <inf> nrf_cloud_info: Device ID: nrf-358299840048751
    [00:00:06.012,817] <inf> nrf_cloud_info: IMEI: 358299840048751
    [00:00:06.013,244] <inf> nrf_cloud_info: Modem FW: mfw_nrf91x1_2.0.2
    [00:00:06.013,275] <inf> nrf_cloud_info: Protocol: MQTT
    [00:00:06.013,305] <inf> nrf_cloud_info: Download protocol: HTTPS
    [00:00:06.013,336] <inf> nrf_cloud_info: Sec tag: 16842753
    [00:00:06.013,366] <inf> nrf_cloud_info: Host name: mqtt.nrfcloud.com
    [00:00:06.013,397] <inf> main: Connected to nRF Cloud
    [00:00:06.013,397] <inf> main: Starting nRF9161 Sensor Cloud Application
    [00:00:06.122,314] <inf> main: Unhandled cloud event: 2
    [00:00:06.139,343] <inf> nrf_cloud_credentials: Sec Tag: 16842753; CA: Yes, Client Cert: Yes, Private Key: Yes
    [00:00:06.139,373] <inf> nrf_cloud_credentials: CA Size: 1188, AWS: Likely, CoAP: Unlikely
    [00:00:06.139,404] <inf> main: Checking credentials in sec tag 16842753
    [00:00:06.139,404] <err> main: Failed to get modem info: -22
    [00:00:06.291,625] <inf> main: Temp: 24.810000°C, Humidity: 37.232421%, Light: 45.000000 lux
    [00:00:06.291,656] <err> main: Disconnect check failed: -13
    [00:00:06.291,656] <inf> main: Attempting to connect...
    [00:00:06.291,656] <err> main: Connect failed: -11, retries left: 2
    [00:00:09.123,809] <inf> main: Transport connected
    [00:00:09.876,647] <err> nrf_cloud_fsm: Error decoding shadow data, error: -35
    [00:00:09.876,647] <err> nrf_cloud_fsm: Handler failed! state: 5, type: 3
    [00:00:09.876,647] <err> nrf_cloud_transport: nct_input: failed -35
    [00:00:11.294,097] <inf> main: Transport disconnected
    [00:00:11.294,128] <inf> main: Attempting to connect...
    [00:00:11.294,128] <err> main: Connect failed: -11, retries left: 1
    [00:00:16.294,250] <err> main: Disconnect check failed: -13
    [00:00:16.294,281] <inf> main: Attempting to connect...
    [00:00:16.294,311] <inf> main: Unhandled cloud event: 2
    [00:00:18.294,525] <inf> main: Sending: {"temperature":24.810000,"humidity":37.232421,"light":45.000000}
    [00:00:18.294,555] <err> main: Send failed: -13
    [00:00:18.883,178] <inf> main: Transport connected
    [00:00:19.718,994] <err> nrf_cloud_fsm: Error decoding shadow data, error: -35
    [00:00:19.719,024] <err> nrf_cloud_fsm: Handler failed! state: 5, type: 3
    [00:00:19.719,055] <err> nrf_cloud_transport: nct_input: failed -35
    [00:00:23.294,647] <err> main: Failed to send data after retries
    [00:00:23.294,677] <err> main: Data send failed, will retry
    [00:00:24.877,838] <inf> main: Unhandled LTE event: 3