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

Parents Reply Children
  • Thanks for providing this trace. 

    There seems to be an issue with the Vodafone SIM as it gets rejected from the network with message:

    Roaming not allowed in this tracking area (13)

    I would reach out to Vodafone and ask them about the coverage in your area. I reached out to our sales team in the UK yesterday regarding your case, and they informed me that O2 is the only one doing LTE-M in the UK, but there seems to be an issue with the SIM you were using. Best to try a O2 SIM to test with LTE-M. 

    Kind regards,
    Øyvind

  • Thanks Øyvind,

    I talked to O2 and they told me that the Tesco SIM I have uses their network so it will act the same as an O2 SIM.

    It seems to be connecting but I dont think the signal is strong enough.

    trace-2024-06-25T09-53-38.262Z.mtrace

    Rod

  • Yes, correct, the signal seems to be the issue here. From the modem trace I see that your connection times out. If O2 confirms that Tesco SIM should be fully supported, and your device is registered to home network (as it states), then I would suggest testing at other locations.

    Could there be equipment close to your board/location causing interreference with the LTE signal?

  • 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