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