-
-
Description:
I am working on an application using the nRF9160 and encountered an issue where the
#MQTTEVT
event is not triggered after connecting to an MQTT broker using theAT#XMQTTCON
command. Based on my understanding, the expected behavior is for#MQTTEVT
to respond with(0,0)
upon successfully establishing the connection, but this event is missing in my case.Below is the sequence of commands and full logs:
[19:24:15] ➞ AT#XRESET [19:24:15] ➞ OK [19:24:18] ➞ Ready [19:24:18] ➞ AT#XMODEMRESET [19:24:18] ➞ #XMODEMRESET: 0 OK [19:24:18] ➞ AT+CFUN=0 [19:24:19] ➞ OK AT%XSYSTEMMODE=1,1,0,1 [19:24:19] ➞ OK AT+CFUN=1 [19:24:19] ➞ OK AT+CFUN? [19:24:19] ➞ +CFUN: 1 OK [19:24:19] ➞ AT+CGDCONT=1,"IP","NB-IOT.CLARO.COM.BR" [19:24:20] ➞ OK AT+CEREG=1 [19:24:20] ➞ OK [19:24:20] ➞ AT+CEREG? [19:24:21] ➞ +CEREG: 1,4 OK [19:24:21] ➞ AT+CEREG? [19:24:22] ➞ +CEREG: 1,4 OK [19:24:22] ➞ AT+CEREG? [19:24:23] ➞ +CEREG: 1,2 OK [19:24:23] ➞ AT+CEREG? [19:24:24] ➞ +CEREG: 1,1 OK [19:24:24] ➞ AT+CESQ=0 [19:24:24] ➞ +CESQ: 99,99,255,255,11,54 OK [19:24:24] ➞ AT#XMQTTCFG="370026001950424B30373620",60,1 [19:24:24] ➞ OK [19:24:24] ➞ AT#XMQTTCON=1,"","","broker.hivemq.com",1883 [19:24:24] ➞ OK [19:24:34] ➞ AT#XMQTTCON? [19:24:34] ➞ #XMQTTCON: 1,"370026001950424B30373620","broker.hivemq.com",1883 OK [19:24:36] ➞ AT#XMQTTPUB="globals/370026001950424B30373620/","",2,0 [19:24:36] ➞ OK {"SN":"370026001950424B30373620","VRX":14514,"VMX":63518,"VRZ":14097,"VMZ":63494,"TEMP":7153,"BAT":36073,"RSSI":-87}+++ [19:24:36] ➞ #XDATAMODE: 116 [19:24:36] ➞ #XDATAMODE: 0 [19:24:38] ➞ #XMQTTEVT: 4,0 [19:24:38] ➞ #XMQTTEVT: 6,0 [19:24:39] ➞ AT#XMQTTCON=0 [19:24:39] ➞ #XMQTTEVT: 1,0
Observed Behavior:
- After sending
AT#XMQTTCON=1,"","","broker.hivemq.com",1883
, I receive anOK
, but there’s no immediate#MQTTEVT (0,0)
event to confirm the connection. - The connection appears to be established successfully after roughly 10 seconds, as verified by
AT#XMQTTCON?
, but I didnt want to use magical delays. - Subsequent operations, like publishing messages (
AT#XMQTTPUB
), work as expected, and other events like#XMQTTEVT (4,0)
and#XMQTTEVT (6,0)
are triggered correctly.
Expected Behavior:
From what I’ve read, the normal behavior is for
#MQTTEVT
to send(0,0)
shortly after executingAT#XMQTTCON=1,...
. This event is critical for precisely handling the connection status in real-time applications. Arbitrary delays are not reliable for production use.
Questions:
- Is the absence of the
#MQTTEVT (0,0)
event expected in this scenario, or is it a potential bug? - Are there specific configurations or firmware versions required to ensure this event is triggered?
- Could this behavior be related to the broker’s response time, or is it more likely a modem issue?
-
Additional Details:
- MQTT Broker: HiveMQ (broker.hivemq.com) on port 1883
- Modem Firmware Version: [fw 1.3.7]
- Development Environment: [2.8.0 sdk version]
- Sometimes I see the #MQTTEVT (0,0) after the mqtt publication, but I dont know why this happen and isnt a consistent behaviour.
Any guidance or suggestions would be greatly appreciated. Thank you!