MQTT Sample Not Connecting on nRF9160 Board

Hi,

Sorry, i am new to MQTT so may be asking a stupid question, please bear with me. 

I am trying to run the MQTT sample (nrf\samples\net\mqtt) and get the following output

*** Booting nRF Connect SDK v3.5.99-ncs1-1 ***
[00:00:00.312,896] <inf> network: Bringing network interface up and connecting to the network
[00:00:00.505,187] <inf> nrf_modem_lib_trace: Trace thread ready
[00:00:00.506,500] <inf> nrf_modem_lib_trace: Trace level override: 2
[00:00:00.508,270] <err> lte_lc: Could not send AT command, error: 65536
[00:00:00.508,270] <err> lte_lc: Failed to set system mode and mode preference, err -14
+CEREG: 2,"01B0","081A1682",7,0,0,"11100000","11100000"
+CSCON: 1
+CSCON: 0
+CSCON: 1
+CGEV: ME PDN ACT 0,0
+CNEC_ESM: 50,0
+CEREG: 1,"01B0","081A1682",7,,,"00011110","00011011"
[00:00:15.113,403] <inf> network: Network connectivity established
+CSCON: 0
+CSCON: 1
+CSCON: 0
+CSCON: 1
+CSCON: 0
+CSCON: 1
+CSCON: 0
+CSCON: 1
[00:00:43.618,835] <err> mqtt_helper: mqtt_connect, error: -116
[00:00:43.618,865] <err> transport: Failed connecting to MQTT, error code: -116
+CSCON: 0

Looking at the cellular monitor, it suggests I am connecting?

Any pointers would be appreciated

Rod

  • Hi Øyvind,

    I have managed to update my toolchain to v2.7.0-rc3. (I had previously tried to update to rc2 and rc1 but it kept flagging an error, so i was running v.2.6.1)

    Updating to rc3 also enabled me to also update to the latest firmware.

    Anyway, this has allowed me to connect correctly. I have not changed my location, I am still physically in the same place, still using a SIM from Tescos.

    +CEREG: 2,"01B0","07C2B478",7
    +CSCON: 1
    +CGEV: ME PDN ACT 0,0
    +CNEC_ESM: 50,0
    +CEREG: 1,"01B0","07C2B478",7,,,"11100000","11100000"
    [00:00:03.503,845] <inf> network: Network connectivity established
    +CSCON: 0
    +CSCON: 1
    [00:00:13.781,951] <inf> transport: Connected to MQTT broker
    [00:00:13.781,982] <inf> transport: Hostname: test.mosquitto.org
    [00:00:13.782,043] <inf> transport: Client ID: 352656106650388
    [00:00:13.782,043] <inf> transport: Port: 8883
    [00:00:13.782,073] <inf> transport: TLS: Yes
    [00:00:13.782,135] <inf> transport: Subscribing to: 352656106650388/my/subscribe/topic
    [00:00:13.894,958] <inf> transport: Subscribed to topic 352656106650388/my/subscribe/topic
    +CSCON: 0
    +CSCON: 1
    +CSCON: 0
    [00:01:00.413,665] <inf> transport: Published message: "Hello MQTT! Current uptime is: 60404" on topic: "352656106650388/my/publish/topic"
    +CSCON: 1
    +CSCON: 0
    +CSCON: 1
    +CSCON: 0
    [00:02:00.413,940] <inf> transport: Published message: "Hello MQTT! Current uptime is: 120404" on topic: "352656106650388/my/publish/topic"
    +CSCON: 1
    +CSCON: 0
    +CSCON: 1
    +CSCON: 0
    +CEREG: 1,"01B0","081A1682",7,,,"11100000","11100000"
    [00:03:00.414,215] <inf> transport: Published message: "Hello MQTT! Current uptime is: 180404" on topic: "352656106650388/my/publish/topic"
    +CSCON: 1
    +CSCON: 0

    So, thanks for your help.


    Regards,
    Rod

    PS my next step is to update the broker address, user name and password to allow me to connect to a different server but i will close this ticket and open a new one if required.

Related