This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

cloud_connect failed: -111

Hi, the thread at https://devzone.nordicsemi.com/f/nordic-q-a/48859/nrf9160-dk-connecting-problems-with-nrf-cloud/211627 has been very useful for me to get past several problems getting the asset tracker example to work. I connect successfully to a NB-IoT network here in Norway now, thanks to (as explained in the linked thread) setting modem mode to NB-IoT, using legacy PCO mode and using a static IP address since DNS is not supported.

Finally, the problem I am left with is "cloud_connect failed: -111". I had high hopes that a certificate update (devzone.nordicsemi.com/.../nrf-cloud-certificate-update) would solve this, but after successfully updating my certificates the same problem still persists. 

I have a nRF9160 DK v 0.8.5, with modem FW updated. I can successfully connect to the network using the at_client sample. Since the SIM included with the dev. kit only supports LTE-M1 (no coverage where I am located), I am using a SIM card from com4.no to connect to NB-IoT.

Here is my output from the terminal:

***** Booting Zephyr OS build v1.14.99-ncs3-snapshot2-2647-gd6e67554cfeb *****


[00:00:00.378,173] 
[0m<dbg> nrf9160_gps.init: MAGPIO set: AT%XMAGPIO=1,0,0,1,1,1574,1577[0m


Asset tracker started


[00:00:00.389,282] 
[0m<dbg> nrf_cloud_transport.nct_client_id_get: client_id = nrf-352656100223414[0m


[00:00:00.398,498] 
[0m<dbg> nrf_cloud_transport.nct_topics_populate: shadow_base_topic: $aws/things/nrf-352656100223414/shadow[0m


[00:00:00.410,156] 
[0m<dbg> nrf_cloud_transport.nct_topics_populate: accepted_topic: nrf-352656100223414/shadow/get/accepted[0m


[00:00:00.421,661] 
[0m<dbg> nrf_cloud_transport.nct_topics_populate: rejected_topic: $aws/things/nrf-352656100223414/shadow/get/rejected[0m


[00:00:00.434,204] 
[0m<dbg> nrf_cloud_transport.nct_topics_populate: update_delta_topic: $aws/things/nrf-352656100223414/shadow/update/delta[0m


[00:00:00.447,082] 
[0m<dbg> nrf_cloud_transport.nct_topics_populate: update_topic: $aws/things/nrf-352656100223414/shadow/update[0m


[00:00:00.458,923] 
[0m<dbg> nrf_cloud_transport.nct_topics_populate: shadow_get_topic: $aws/things/nrf-352656100223414/shadow/get[0m


Connecting to LTE network. This may take several minutes.


[00:00:00.477,172] 
[0m<inf> lte_lc: Using legacy LTE PCO mode...[0m


[00:00:00.483,428] 
[0m<dbg> lte_lc.w_lte_lc_connect: Network mode: AT%XSYSTEMMODE=0,1,1,0[0m


[00:00:04.653,717] 
[0m<dbg> lte_lc.at_handler: recv: +CEREG: 2,"0CEB","0202791C",9,0,0,"11100000","11100000"[0m

[00:00:04.664,123] 
[0m<dbg> lte_lc.parse_nw_reg_status: Network registration status: 2[0m


[00:00:05.574,218] 
[0m<dbg> lte_lc.at_handler: recv: +CEREG: 1,"0CEB","0202791C",9,,,"11100000","11100000"[0m


[00:00:05.584,472] 
[0m<dbg> lte_lc.parse_nw_reg_status: Network registration status: 1[0m


Connected to LTE network


[00:00:05.595,123] 
[0m<dbg> nrf_cloud_transport.nct_connect: IPv4 Address 52.54.149.10[0m


cloud_connect failed: -111


LTE link disconnect


Shutdown modem


***** Booting Zephyr OS build v1.14.99-ncs3-snapshot2-2647-gd6e67554cfeb *****


...

Any other suggestions would be greatly appreciated.

Kind regards,

Terje

Parents
  • Hi.

    The mqtt_socket library merges all errors on connecting to -111 (connection refused).

    However, the reason for your failure to connect might be other things than just some issue with the certificates.

    Can you add a print inside the "if block" ncs/nrf/subsys/net/lib/mqtt_socket/mqtt.c:322 that prints the value of err_code?

    AWS (which nRF Cloud) is built upon uses load balancing, so the IP address of the endpoint you are looking for might change without warning.

    Best regards,

    Didrik

  • Hi, thank you for the feedback.

    Added a print of the error code (and renewed the IP address to connect to).

    In mqtt_connect(): client_connect() returned error code -116

    This seems to indicate a connection timeout, which might make sense if connecting via a higher latency NB-IoT network (and not LTE-M1).

    I'm now trying to figure out how to increase timeout values, but there is a lot of code to read... Do you know how to increase timeout values across the board (socket timeout, AWS timeout and possibly other timeouts)?

Reply
  • Hi, thank you for the feedback.

    Added a print of the error code (and renewed the IP address to connect to).

    In mqtt_connect(): client_connect() returned error code -116

    This seems to indicate a connection timeout, which might make sense if connecting via a higher latency NB-IoT network (and not LTE-M1).

    I'm now trying to figure out how to increase timeout values, but there is a lot of code to read... Do you know how to increase timeout values across the board (socket timeout, AWS timeout and possibly other timeouts)?

Children
Related