SIM800MQTT icon indicating copy to clipboard operation
SIM800MQTT copied to clipboard

MQTT_Init() is trying 3 times to connect MQTT server

Open digidhamu opened this issue 4 years ago • 2 comments

Thanks for great lib.

Observed that MQTT_Init() function is iterating 3 times before connecting to MQTT server though GPRS connection is alive. Is this expected?

Here is my debug message from main.c

08:32:41.030 --> SIM800 Init
08:32:41.526 --> SIM800 Powering
08:32:43.519 --> SIM800 Connecting
08:32:53.495 --> MQTT Connection Setup
08:32:53.495 --> MQTT Connection Init
08:33:09.470 --> MQTT Connection Init
08:33:26.419 --> MQTT Connection Init
08:33:54.365 --> MQTT Connected

digidhamu avatar Aug 31 '21 03:08 digidhamu

Hi! Check out the MQTT_Init(void) function. It has a variable error which accumulates errors if the module's response is not what is expected for a normal connection. You can try to find out at what stage an error occurs by monitoring the step-by-step execution of this function and the module's returned responses.

I had a periodic error of "O/r/n" instead of "OK/r/n" on some operations. But I could not identify the reasons for such a deviation.

leech001 avatar Aug 31 '21 05:08 leech001

Hi! Check out the MQTT_Init(void) function. It has a variable error which accumulates errors if the module's response is not what is expected for a normal connection. You can try to find out at what stage an error occurs by monitoring the step-by-step execution of this function and the module's returned responses.

I had a periodic error of "O/r/n" instead of "OK/r/n" on some operations. But I could not identify the reasons for such a deviation.

Sure @leech001. Will do it in the weekend.

digidhamu avatar Sep 03 '21 04:09 digidhamu