MQTT Client fails on multiple broker connections/disconnections.

Hi there,

We are using the nrf9160 DK with Serial LTE Modem (1.8.0) to run some tests on the modem (1.3.1). We are using the MQTT client AT commands in order to connect to a broker and to publish some data.

This works well, however we are seeing some issues when trying to recover a MQTT connection when there was any sort of failure, and we get the ERROR response.

  • For a first test, we attempt to connect and disconnect from a broker multiple times (HiveMQ test broker):

AT#XMQTTCON=1,"sqn/nordic","","","broker.hivemq.com",1883
OK
#XMQTTEVT: 0,0

AT#XMQTTCON=0
#XMQTTEVT: 1,0
OK

AT#XMQTTCON=1,"sqn/nordic","","","broker.hivemq.com",1883
OK

AT#XMQTTCON=0
ERROR

AT#XMQTTCON=0
ERROR

AT#XMQTTCON=1,"sqn/nordic","","","broker.hivemq.com",1883
ERROR

as can be seen in the above snippet, the first connection is successful as well as the disconnection. However, when we attempt to connect for a second time, the #XMQTTEVT: 0,0 notification is never received, even after waiting multiple minutes. There after, any MQTT AT command used yields the error response from the modem, and there seems to be no way to re-establish an MQTT connection. Not even turning the modem off and on (CFUN=0/1) fixes this. The only solution thus far is to reset the entire chip with the reset button on the 9160 DK or remove power.

  • We also test how the device recovers from broker failure by connecting the device to a local hivemq broker, publishing some data, and then we turn the broker off and on. As expecting, when the device attempts to publish again we get the following failure event: #XMQTTEVT: 1,-113. Now, when we reattempt to connect to the broker, we never get the #XMQTTEVT: 0,0 as mentioned in the first test.

AT#XMQTTCON=1,"sqn/nordic","","","<ip address>",1883
OK

To reset the entire chip will be very bad for current consumption, as the device will need to go through the MNO attach procedure each time. How can we get the device to connect to the broker multiple times?

I hope the question is clear.

Thanks

Frikkie

Parents
  • Hi Frikkie,

    I have tried to reproduce results from your first test using the commands which you provided. I have used modem firmware version 1.3.1 and LTE Link Monitor v2.0.2. The result is that I cannot confirm your findings. I was able to successfully connect and disconnect from the broker multiple times without issues. The only way how I could get the error which you describe is running this sequence

    AT#XMQTTCON=1,"sqn/nordic","","","broker.hivemq.com",1883
    AT+CFUN=1
    AT#XMQTTCON=1,"sqn/nordic","","","broker.hivemq.com",1883

    The error disappeared after running AT#XMQTTCON=0. Could you test this yourself?


    Could you provide necessary steps for reproducing the behavior that you described in your second test?

    Best regards,
    Dejan

  • Hi Dejans,

    Thanks for the feedback. Just to be sure we are running the same test, which mqtt broker are you using for the test? Also, what version of the Serial LTE Modem application are you running (which SDK version)?

    Regards,

    Frikkie

Reply Children
Related