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

Mqtt client Nrf9160 Module

My nrf9160 isn't responsive to the AT commands for MQTT mentioned here. I want to know why is that so?
I've put certificates in the module from AWS-Iot core and flashed at_client example inside the nrf9160 and trying to send AT#XMQTTCON command to connect it to the broker. 

Am I missing something or 
Is this a work in progress and these commands aren't available yet? 
I want to make use to this mqtt client to connect to AWS-IoT instead of doing in in the application, I suppose that'll be possible as well.

here in or at this place; where the speaker or writer is More (Definitions, Synonyms, Translation)

  • Hello

    I'm seeing the same issue as you with SLM. When trying to send XMQTTCON i receive ERROR. Will forward to our developer.

    Kind regards,
    Øyvind

  • Hi,

    I could finally connect to AWS-IoT core on SLM.
    There are issues with the slm application I suppose, but here is what I did that let me connect.

    1. Updated Modem to latest fw.
    2. Removed all the certificates that were there in the modem.
    3. Flashed new certificates on the modem for the IoT thing created in AWS.
    4. In AWS IoT Core, subscribed to all the topics mentioned below:
    • aws/things/uskh-n91/shadow/get/accepted
    • aws/things/uskh-n91/shadow/get/rejected
    • Aws/things/uskh-n91/shadow/update/accepted
    • aws/things/uskh-n91/shadow/update/delta
    • aws/things/uskh-n91/shadow/update/rejected
    • aws/things/uskh-n91/shadow/delete/accepted
    • aws/things/uskh-n91/shadow/delete/rejected

    From LTE Link Monitor I sent the following commands:

    • AT+CFUN=1
    • AT+CFUN? (Queries all the configurations if automatic requests are enabled on LTE Link Monitor)

      Now, once I see LTE is registered, I send the XMQTTCON  and it responds with 

      2021-01-26T02:36:27.941Z DEBUG modem << OK
      2021-01-26T02:36:28.621Z DEBUG modem << #XMQTTEVT: 0,0

      Attached are the logs for your reference.

      Now I haven't dug deep into the issue and it can be looked into further and fixed.

      However, following those steps I could establish a connection and publish and subscribe to AWS via MQTT.

    Please update the documentation here, like I mentioned before, that's very misleading, stating 0 for connect and 1 for disconnect.

    2021-01-26T02:35:45.458Z INFO Modem port is opened
    2021-01-26T02:35:45.466Z DEBUG modem >> AT+CFUN?
    2021-01-26T02:35:45.495Z DEBUG modem << +CFUN: 0
    2021-01-26T02:35:45.500Z DEBUG modem << OK
    2021-01-26T02:35:58.365Z DEBUG modem >> AT
    2021-01-26T02:35:58.378Z DEBUG modem << OK
    2021-01-26T02:35:59.479Z DEBUG modem >> AT+CFUN?
    2021-01-26T02:35:59.493Z DEBUG modem << +CFUN: 0
    2021-01-26T02:35:59.504Z DEBUG modem << OK
    2021-01-26T02:36:00.382Z DEBUG modem >> AT+CFUN=1
    2021-01-26T02:36:00.425Z DEBUG modem << OK
    2021-01-26T02:36:01.413Z DEBUG modem >> AT+CFUN?
    2021-01-26T02:36:01.426Z DEBUG modem << +CFUN: 1
    2021-01-26T02:36:01.436Z DEBUG modem << OK
    2021-01-26T02:36:01.441Z DEBUG modem >> AT+CGSN=1
    2021-01-26T02:36:01.458Z DEBUG modem << +CGSN: "352656100371932"
    2021-01-26T02:36:01.461Z DEBUG modem << OK
    2021-01-26T02:36:01.466Z DEBUG modem >> AT+CGMI
    2021-01-26T02:36:01.484Z DEBUG modem << Nordic Semiconductor ASA
    2021-01-26T02:36:01.494Z DEBUG modem << OK
    2021-01-26T02:36:01.498Z DEBUG modem >> AT+CGMM
    2021-01-26T02:36:01.511Z DEBUG modem << nRF9160-SICA
    2021-01-26T02:36:01.513Z DEBUG modem << OK
    2021-01-26T02:36:01.520Z DEBUG modem >> AT+CGMR
    2021-01-26T02:36:01.536Z DEBUG modem << mfw_nrf9160_1.2.3
    2021-01-26T02:36:01.543Z DEBUG modem << OK
    2021-01-26T02:36:01.545Z INFO Nordic Semiconductor ASA nRF9160-SICA [mfw_nrf9160_1.2.3] SerNr: 352656100371932
    2021-01-26T02:36:01.546Z DEBUG modem >> AT+CEMODE?
    2021-01-26T02:36:01.559Z DEBUG modem << +CEMODE: 2
    2021-01-26T02:36:01.561Z DEBUG modem << OK
    2021-01-26T02:36:01.569Z DEBUG modem >> AT%XCBAND=?
    2021-01-26T02:36:01.589Z DEBUG modem << %XCBAND: (1,2,3,4,5,8,12,13,18,19,20,25,26,28,66)
    2021-01-26T02:36:01.591Z DEBUG modem << OK
    2021-01-26T02:36:01.600Z DEBUG modem >> AT+CMEE?
    2021-01-26T02:36:01.613Z DEBUG modem << +CMEE: 0
    2021-01-26T02:36:01.616Z DEBUG modem << OK
    2021-01-26T02:36:01.620Z DEBUG modem >> AT+CMEE=1
    2021-01-26T02:36:01.632Z DEBUG modem << OK
    2021-01-26T02:36:01.634Z DEBUG modem >> AT+CNEC?
    2021-01-26T02:36:01.646Z DEBUG modem << +CNEC: 0
    2021-01-26T02:36:01.649Z DEBUG modem << OK
    2021-01-26T02:36:01.658Z DEBUG modem >> AT+CNEC=24
    2021-01-26T02:36:01.674Z DEBUG modem << OK
    2021-01-26T02:36:01.678Z DEBUG modem >> AT+CGEREP?
    2021-01-26T02:36:01.691Z DEBUG modem << +CGEREP: 0,0
    2021-01-26T02:36:01.695Z DEBUG modem << OK
    2021-01-26T02:36:01.697Z DEBUG modem >> AT+CGDCONT?
    2021-01-26T02:36:01.711Z DEBUG modem << OK
    2021-01-26T02:36:01.716Z DEBUG modem >> AT+CGACT?
    2021-01-26T02:36:01.730Z DEBUG modem << OK
    2021-01-26T02:36:01.734Z DEBUG modem >> AT+CGEREP=1
    2021-01-26T02:36:01.746Z DEBUG modem << OK
    2021-01-26T02:36:01.752Z DEBUG modem >> AT+CIND=1,1,1
    2021-01-26T02:36:01.766Z DEBUG modem << OK
    2021-01-26T02:36:01.770Z DEBUG modem >> AT+CEREG=5
    2021-01-26T02:36:01.783Z DEBUG modem << OK
    2021-01-26T02:36:01.786Z DEBUG modem >> AT+CEREG?
    2021-01-26T02:36:01.807Z DEBUG modem << +CEREG: 5,4,"FFFE","FFFFFFFF",7,0,0,"00000000","00000000"
    2021-01-26T02:36:01.809Z DEBUG modem << OK
    2021-01-26T02:36:01.819Z DEBUG modem >> AT%CESQ=1
    2021-01-26T02:36:01.833Z DEBUG modem << OK
    2021-01-26T02:36:01.837Z DEBUG modem >> AT+CESQ
    2021-01-26T02:36:01.852Z DEBUG modem << +CESQ: 99,99,255,255,255,255
    2021-01-26T02:36:01.853Z DEBUG modem << OK
    2021-01-26T02:36:01.865Z DEBUG modem >> AT%XSIM=1
    2021-01-26T02:36:01.877Z DEBUG modem << OK
    2021-01-26T02:36:01.881Z DEBUG modem >> AT%XSIM?
    2021-01-26T02:36:01.895Z DEBUG modem << %XSIM: 1
    2021-01-26T02:36:01.898Z DEBUG modem << OK
    2021-01-26T02:36:01.902Z DEBUG modem >> AT+CPIN?
    2021-01-26T02:36:01.915Z DEBUG modem << +CPIN: READY
    2021-01-26T02:36:01.917Z DEBUG modem << OK
    2021-01-26T02:36:01.929Z DEBUG modem >> AT+CPINR="SIM PIN"
    2021-01-26T02:36:01.950Z DEBUG modem << +CPINR: "SIM PIN",3
    2021-01-26T02:36:01.953Z DEBUG modem << OK
    2021-01-26T02:36:01.962Z DEBUG modem >> AT+CIMI
    2021-01-26T02:36:01.978Z DEBUG modem << 901405101886716
    2021-01-26T02:36:01.979Z DEBUG modem << OK
    2021-01-26T02:36:01.980Z INFO IMSIdentity: 901405101886716
    2021-01-26T02:36:02.331Z DEBUG modem << %CESQ: 28,1,0,0
    2021-01-26T02:36:02.342Z DEBUG modem << +CEREG: 2,"000E","0016F303",7,0,0,"11100000","11100000"
    2021-01-26T02:36:06.272Z DEBUG modem << +CGEV: ME PDN ACT 0,0
    2021-01-26T02:36:06.282Z DEBUG modem >> AT+CGDCONT?
    2021-01-26T02:36:06.286Z DEBUG modem << +CNEC_ESM: 50,0
    2021-01-26T02:36:06.289Z DEBUG modem << +CEREG: 5,"000E","0016F303",7,,,"11100000","11100000"
    2021-01-26T02:36:06.290Z DEBUG modem << +CIND: "service",1
    2021-01-26T02:36:06.292Z DEBUG modem << +CIND: "roam",1
    2021-01-26T02:36:06.300Z DEBUG modem << +CGDCONT: 0,"IP","iot.1nce.net","10.34.30.243",0,0
    2021-01-26T02:36:06.303Z DEBUG modem << OK
    2021-01-26T02:36:06.312Z DEBUG modem >> AT+CGACT?
    2021-01-26T02:36:06.329Z DEBUG modem << +CGACT: 0,1
    2021-01-26T02:36:06.332Z DEBUG modem << OK
    2021-01-26T02:36:06.642Z DEBUG modem << %CESQ: 30,1,5,0
    2021-01-26T02:36:07.236Z DEBUG modem >> at
    2021-01-26T02:36:07.244Z DEBUG modem << OK
    2021-01-26T02:36:21.115Z DEBUG modem >> AT#XMQTTCON=1,"uskh-n91","","","endpoint.amazonaws.com",8883,777
    2021-01-26T02:36:22.119Z ERROR Error: 'AT#XMQTTCON=1,"uskh-n91","","","endpoint.amazonaws.com",8883,777
    ' timed out
    2021-01-26T02:36:27.941Z DEBUG modem << OK
    2021-01-26T02:36:28.621Z DEBUG modem << #XMQTTEVT: 0,0
    2021-01-26T02:36:38.125Z DEBUG modem << %CESQ: 29,1,0,0
    2021-01-26T02:36:41.532Z DEBUG modem << %CESQ: 30,1,6,0
    2021-01-26T02:36:50.562Z DEBUG modem << %CESQ: 29,1,1,0
    2021-01-26T02:37:28.894Z DEBUG modem << #XMQTTEVT: 9,0
    2021-01-26T02:37:28.950Z DEBUG modem >> at
    2021-01-26T02:37:28.959Z DEBUG modem << OK
    2021-01-26T02:37:54.238Z DEBUG modem << %CESQ: 30,1,6,0
    2021-01-26T02:37:55.641Z DEBUG modem << %CESQ: 29,1,1,0
    2021-01-26T02:37:59.259Z DEBUG modem << %CESQ: 29,1,6,0
    2021-01-26T02:38:01.865Z DEBUG modem << %CESQ: 29,1,1,0
    2021-01-26T02:38:28.992Z DEBUG modem << #XMQTTEVT: 9,0
    2021-01-26T02:38:35.071Z DEBUG modem << +CEREG: 5,"000E","00141003",7,,,"11100000","11100000"
    2021-01-26T02:38:35.090Z DEBUG modem >> AT+COPS=3,2
    2021-01-26T02:38:35.105Z DEBUG modem << OK
    2021-01-26T02:38:35.113Z DEBUG modem >> AT+COPS?
    2021-01-26T02:38:35.124Z DEBUG modem << +COPS: 0,2,"45008",7
    2021-01-26T02:38:35.127Z DEBUG modem << OK
    2021-01-26T02:38:35.140Z DEBUG modem >> AT%XCBAND
    2021-01-26T02:38:35.147Z DEBUG modem << %XCBAND: 3
    2021-01-26T02:38:35.150Z DEBUG modem << OK
    2021-01-26T02:38:35.164Z DEBUG modem >> AT+CGDCONT?
    2021-01-26T02:38:35.177Z DEBUG modem << +CGDCONT: 0,"IP","iot.1nce.net","10.34.30.243",0,0
    2021-01-26T02:38:35.179Z DEBUG modem << OK
    2021-01-26T02:38:35.195Z DEBUG modem >> AT+CGACT?
    2021-01-26T02:38:35.208Z DEBUG modem << +CGACT: 0,1
    2021-01-26T02:38:35.210Z DEBUG modem << OK
    2021-01-26T02:38:36.416Z DEBUG modem << %CESQ: 33,1,8,1
    2021-01-26T02:38:51.870Z DEBUG modem << %CESQ: 33,1,3,0
    2021-01-26T02:39:04.312Z DEBUG modem << %CESQ: 35,1,8,1
    2021-01-26T02:39:09.213Z DEBUG modem << %CESQ: 33,1,0,0
    2021-01-26T02:39:11.768Z DEBUG modem << %CESQ: 33,1,6,0
    2021-01-26T02:39:25.848Z DEBUG modem << %CESQ: 34,1,11,1
    2021-01-26T02:39:28.077Z DEBUG modem << %CESQ: 31,1,3,0
    2021-01-26T02:39:28.774Z DEBUG modem << #XMQTTEVT: 9,0
    2021-01-26T02:39:32.295Z DEBUG modem << %CESQ: 36,1,7,1
    2021-01-26T02:39:41.922Z DEBUG modem << %CESQ: 37,1,12,1
    2021-01-26T02:39:42.320Z DEBUG modem << %CESQ: 36,1,7,1
    2021-01-26T02:39:43.210Z DEBUG modem << %CESQ: 31,1,9,1
    2021-01-26T02:39:43.291Z DEBUG modem << +CEREG: 5,"000E","0016F303",7,,,"11100000","11100000"
    2021-01-26T02:39:43.300Z DEBUG modem >> AT+COPS=3,2
    2021-01-26T02:39:43.307Z DEBUG modem << OK
    2021-01-26T02:39:43.317Z DEBUG modem >> AT+COPS?
    2021-01-26T02:39:43.325Z DEBUG modem << +COPS: 0,2,"45008",7
    2021-01-26T02:39:43.336Z DEBUG modem << OK
    2021-01-26T02:39:43.343Z DEBUG modem >> AT%XCBAND
    2021-01-26T02:39:43.353Z DEBUG modem << %XCBAND: 3
    2021-01-26T02:39:43.357Z DEBUG modem << OK
    2021-01-26T02:39:43.366Z DEBUG modem >> AT+CGDCONT?
    2021-01-26T02:39:43.384Z DEBUG modem << +CGDCONT: 0,"IP","iot.1nce.net","10.34.30.243",0,0
    2021-01-26T02:39:43.386Z DEBUG modem << OK
    2021-01-26T02:39:43.392Z DEBUG modem >> AT+CGACT?
    2021-01-26T02:39:43.400Z DEBUG modem << +CGACT: 0,1
    2021-01-26T02:39:43.401Z DEBUG modem << OK
    2021-01-26T02:39:44.011Z DEBUG modem << %CESQ: 31,1,4,0
    2021-01-26T02:39:49.424Z DEBUG modem << %CESQ: 33,1,9,1
    2021-01-26T02:39:50.434Z DEBUG modem << %CESQ: 32,1,4,0
    2021-01-26T02:39:51.036Z DEBUG modem << %CESQ: 32,1,9,1
    2021-01-26T02:39:56.250Z DEBUG modem << %CESQ: 29,1,3,0
    2021-01-26T02:40:28.896Z DEBUG modem << #XMQTTEVT: 9,0
    2021-01-26T02:41:27.456Z DEBUG modem << +CEREG: 5,"000E","00141003",7,,,"11100000","11100000"
    2021-01-26T02:41:27.475Z DEBUG modem >> AT+COPS=3,2
    2021-01-26T02:41:27.489Z DEBUG modem << OK
    2021-01-26T02:41:27.497Z DEBUG modem >> AT+COPS?
    2021-01-26T02:41:27.512Z DEBUG modem << +COPS: 0,2,"45008",7
    2021-01-26T02:41:27.515Z DEBUG modem << OK
    2021-01-26T02:41:27.522Z DEBUG modem >> AT%XCBAND
    2021-01-26T02:41:27.534Z DEBUG modem << %XCBAND: 3
    2021-01-26T02:41:27.537Z DEBUG modem << OK
    2021-01-26T02:41:27.551Z DEBUG modem >> AT+CGDCONT?
    2021-01-26T02:41:27.569Z DEBUG modem << +CGDCONT: 0,"IP","iot.1nce.net","10.34.30.243",0,0
    2021-01-26T02:41:27.570Z DEBUG modem << OK
    2021-01-26T02:41:27.573Z DEBUG modem >> AT+CGACT?
    2021-01-26T02:41:27.585Z DEBUG modem << +CGACT: 0,1
    2021-01-26T02:41:27.587Z DEBUG modem << OK
    2021-01-26T02:41:28.705Z DEBUG modem << #XMQTTEVT: 9,0
    2021-01-26T02:41:28.884Z DEBUG modem << %CESQ: 34,1,7,1
    2021-01-26T02:41:31.693Z DEBUG modem << %CESQ: 30,1,2,0
    2021-01-26T02:41:40.795Z DEBUG modem << +CEREG: 5,"000E","0016F303",7,,,"11100000","11100000"
    2021-01-26T02:41:40.809Z DEBUG modem >> AT+COPS=3,2
    2021-01-26T02:41:40.815Z DEBUG modem << OK
    2021-01-26T02:41:40.821Z DEBUG modem >> AT+COPS?
    2021-01-26T02:41:40.834Z DEBUG modem << +COPS: 0,2,"45008",7
    2021-01-26T02:41:40.840Z DEBUG modem << OK
    2021-01-26T02:41:40.846Z DEBUG modem >> AT%XCBAND
    2021-01-26T02:41:40.854Z DEBUG modem << %XCBAND: 3
    2021-01-26T02:41:40.857Z DEBUG modem << OK
    2021-01-26T02:41:40.868Z DEBUG modem >> AT+CGDCONT?
    2021-01-26T02:41:40.882Z DEBUG modem << +CGDCONT: 0,"IP","iot.1nce.net","10.34.30.243",0,0
    2021-01-26T02:41:40.883Z DEBUG modem << OK
    2021-01-26T02:41:40.886Z DEBUG modem >> AT+CGACT?
    2021-01-26T02:41:40.900Z DEBUG modem << +CGACT: 0,1
    2021-01-26T02:41:40.902Z DEBUG modem << OK
    2021-01-26T02:41:41.504Z DEBUG modem << %CESQ: 30,1,7,1
    2021-01-26T02:41:49.322Z DEBUG modem << %CESQ: 31,1,2,0
    2021-01-26T02:41:52.727Z DEBUG modem << %CESQ: 31,1,7,1
    2021-01-26T02:41:55.142Z DEBUG modem << %CESQ: 30,1,2,0
    2021-01-26T02:42:08.182Z DEBUG modem << %CESQ: 31,1,7,1
    2021-01-26T02:42:13.815Z DEBUG modem << %CESQ: 30,1,0,0
    2021-01-26T02:42:13.821Z DEBUG modem << +CEREG: 5,"000E","00141003",7,,,"11100000","11100000"
    2021-01-26T02:42:13.836Z DEBUG modem >> AT+COPS=3,2
    2021-01-26T02:42:13.848Z DEBUG modem << OK
    2021-01-26T02:42:13.851Z DEBUG modem >> AT+COPS?
    2021-01-26T02:42:13.869Z DEBUG modem << +COPS: 0,2,"45008",7
    2021-01-26T02:42:13.871Z DEBUG modem << OK
    2021-01-26T02:42:13.890Z DEBUG modem >> AT%XCBAND
    2021-01-26T02:42:13.904Z DEBUG modem << %XCBAND: 3
    2021-01-26T02:42:13.906Z DEBUG modem << OK
    2021-01-26T02:42:13.921Z DEBUG modem >> AT+CGDCONT?
    2021-01-26T02:42:13.938Z DEBUG modem << +CGDCONT: 0,"IP","iot.1nce.net","10.34.30.243",0,0
    2021-01-26T02:42:13.940Z DEBUG modem << OK
    2021-01-26T02:42:13.950Z DEBUG modem >> AT+CGACT?
    2021-01-26T02:42:13.965Z DEBUG modem << +CGACT: 0,1
    2021-01-26T02:42:13.967Z DEBUG modem << OK
    2021-01-26T02:42:15.802Z INFO Modem port is closed
    

    terminal a contact on an electrical device (such as a battery) at which electric current enters or leaves More (Definitions, Synonyms, Translation)

  • Hello, 

    I'm glad that you were able to fix this issue. I have reported the documentation bug to our NCS team.

    Kind regards,
    Øyvind

Related