I am using the BG96 and trying to post some data on a custom MQTT broker. It works fine for a few MQTT publish but for some reason, I happen to have a QMTPUB command that doesn’t have response from the modem.
I cannot find an answer to why the modem never replies to the command, even to tell me that it timed out.
I tested the following command with various parameters but never made it work properly:
AT+QMTCFG="timeout",0,30,5,1\r\n
I am sure that my custom timeout is longer than the command timeout (30s_Timout*5_retry = 150s, my timeout is 180s).
For reference here is the file with all the logs until the problem happens
@Aug are you making sure before publish that PDP context is activated?
AT+QIACT? gives you IP address when it is active.
In my BG95-M3 application, when the PDP context is dropped due to network disconnection or data call disconnection, there’s a delay before anything is received in the mqtt_connection_callback. This delay seems to be equal to the keep-alive timeout.
I’ve observed that even after PDP disconnection, the MQTT connection remains intact (AT+QMTCONN? returns OK) until the keep-alive timeout. I believe this might be what’s happening with your situation as well.
Perhaps you could try the following:
Verify if the data call is connected before publishing.
Decrease the keep-alive timeout (try 10).
Subscribe to a topic and continuously publish on that topic to ensure MQTT is functioning bidirectionally.