Need help connecting to MQTT using nRF9160

I can't figure out what I'm missing. I'm not able to send messages using MQTT.

Here's the link to my code: https://github.com/pranav-ether/test/tree/main/mqtt_pub

This are the logs:

[00:02:58.031,768] <inf> LTE: Network registration status: Connected - home network
[00:02:58.031,890] <inf> LTE: Connected to LTE network
[00:02:58.031,921] <inf> LTE: ====== Cell Network Info ======
[00:02:58.033,477] <inf> LTE: Signal strength: 42
[00:02:58.034,210] <inf> LTE: Current LTE band: 8
[00:02:58.034,912] <inf> LTE: Supported LTE bands: (1,2,3,4,5,8,12,13,17,19,20,25,26,28,66)
[00:02:58.035,705] <inf> LTE: Tracking area code: 8CA1
[00:02:58.036,468] <inf> LTE: Current mode: 0
[00:02:58.037,200] <inf> LTE: Current operator name: 65501
[00:02:58.038,146] <inf> LTE: Cell ID of the device: 0E446D21
[00:02:58.039,337] <inf> LTE: IP address of the device: 100.67.202.179
[00:02:58.039,886] <inf> LTE: Modem firmware version: mfw_nrf9160_1.3.5
[00:02:58.040,618] <inf> LTE: LTE-M support mode: 0
[00:02:58.041,259] <inf> LTE: NB-IoT support mode: 1
[00:02:58.041,900] <inf> LTE: GPS support mode: 0
[00:02:58.042,633] <inf> LTE: Mobile network time and date: 24/08/13,06:33:37+08
[00:02:58.042,633] <inf> LTE: ===============================
[00:02:58.043,121] <inf> MQTT: Connection to broker using mqtt_init
[00:04:23.972,839] <err> mqtt_helper: Cloud MQTT keepalive ping failed: -128

  • Custom Board uses 1.3.5 afaik. It's opening on my system. On the Cellular Monitor app, I don't know why the AT Commands are missing on when I select 1.3.5. When I select 1.3.6 AT commands are shown.

  • Hi Pranav,

    Thanks for sharing. I mange to open it and see the same information, but unfortunately, the modem trace only show 34-sconds communication and device stop at trying to attched to NB netrowk.

    Have you try to wait a bit longer so there might be some reject resone give by basestation side? Or device keeping stucking like this?

    Running AT%CONEVAL before CFUN=1 can provide more informaiton about sournding network.

    docs.nordicsemi.com/.../coneval_set.html

    Best regards,

    Charlie

  • Trace was recorded for about 10mins, but looks like there was only activity for 34sec.

    I just tried running AT%CONEVAL just after boot (before connection) on my DK and this is what I got:

    rtt:~$ at AT%CONEVAL
    %CONEVAL: 1
    OK

    Is this expected?
    I'll try with my custom board a bit later.

  • It should look like this.

    mosh:~$ > at AT+CFUN=1
    at AT+CFUN=1
    OK
    
    PDN event: PDP context 0 activated
    PDN event: PDP context 0 IPv6 up
    mosh:~$ > at AT%CONEVAL
    at AT%CONEVAL
    %CONEVAL: 0,1,9,73,15,34,"03238D05","24201",457,6400,20,0,0,-13,1,1,88
    OK
    
    mosh:~$ > at AT%CONEVAL
    at AT%CONEVAL
    %CONEVAL: 0,1,7,73,11,26,"03238D05","24201",457,6400,20,0,0,-13,1,1,88
    OK

    Best regards,

    Charlie

  • When using RTT shell this is all I get, after this it crashes. When I hit the Enter key after the last command, the shell closes automatically. I have tried this multiple times, always crashes after this point. This might have caused RTT logs to fail. How to fix that?

    rtt:~$ at AT+CGMR
    mfw_nrf9160_1.3.6
    OK
    
    rtt:~$ Modem domain event: Search done
    Network registration status: unknown
    LTE cell changed: ID: -1, Tracking area: -1
    
    rtt:~$ 
    rtt:~$ at AT+CFUN=4
    Network registration status: not registered
    OK
    
    rtt:~$ at AT%XSYSTEMMODE=0,1,0,0
    OK
    
    rtt:~$ at AT+CFUN=1
    OK
    
    rtt:~$ at AT+CGDCONT?
    OK
    
    rtt:~$ at AT%CONEVAL
    %CONEVAL: 1
    OK
    
    rtt:~$ Network registration status: searching
    Currently active system mode: NB-IoT
    LTE cell changed: ID: 279440, Tracking area: 49173

Related