Problem with espmqtt...

stefanoxjx
Posts: 25
Joined: Mon Feb 12, 2018 6:26 pm

Problem with espmqtt...

Postby stefanoxjx » Sat Jun 16, 2018 4:16 pm

Hi, I've a problem with espmqtt.
When I send packets with frequency greater than 50Hz I've many of this messages:

Code: Select all

Guru Meditation Error: Core  1 panic'ed (LoadProhibited)
. Exception was unhandled.
Core 1 register dump:
PC      : 0x4000c250  PS      : 0x00060330  A0      : 0x800dbf79  A1      : 0x3ffcad50  
A2      : 0x00000000  A3      : 0x00000000  A4      : 0x0000020d  A5      : 0x3f400718  
A6      : 0x3ffcad80  A7      : 0xff000000  A8      : 0x80082de8  A9      : 0x3ffcad20  
A10     : 0x00000000  A11     : 0xffffffff  A12     : 0x00000004  A13     : 0x00000001  
A14     : 0x00000004  A15     : 0xff000000  SAR     : 0x00000004  EXCCAUSE: 0x0000001c  
EXCVADDR: 0x00000000  LBEG    : 0x400014fd  LEND    : 0x4000150d  LCOUNT  : 0xffffffff  

Backtrace: 0x4000c250:0x3ffcad50 0x400dbf76:0x3ffcad70 0x400d4121:0x3ffcb080 0x400d304a:0x3ffcb0d0 0x401116ed:0x3ffcb0f0 0x4011197d:0x3ffcb110 0x40111b3a:0x3ffcb150 0x40111d30:0x3ffcb180
0x400dbf76: _vfprintf_r at /Users/ivan/e/newlib_xtensa-2.2.0-bin/newlib_xtensa-2.2.0/xtensa-esp32-elf/newlib/libc/stdio/../../../.././newlib/libc/stdio/vfprintf.c:1522

0x400d4121: printf at /Users/ivan/e/newlib_xtensa-2.2.0-bin/newlib_xtensa-2.2.0/xtensa-esp32-elf/newlib/libc/stdio/../../../.././newlib/libc/stdio/printf.c:58

0x400d304a: mqtt_event_handler at ./ESP32/Leanbit-mpu6050/main/./mqtt.c:62 (discriminator 1)

0x401116ed: esp_mqtt_dispatch_event at ./ESP32/Leanbit-mpu6050/main/espmqttaaa/./mqtt_client.c:353

0x4011197d: deliver_publish at ./ESP32/Leanbit-mpu6050/main/espmqttaaa/./mqtt_client.c:353

0x40111b3a: mqtt_process_receive at ./ESP32/Leanbit-mpu6050/main/espmqttaaa/./mqtt_client.c:353

0x40111d30: esp_mqtt_task at ./ESP32/Leanbit-mpu6050/main/espmqttaaa/./mqtt_client.c:353


Rebooting...
If I send messages at frequency lower than 50Hz it work fine, but sometimes I see this message:

Code: Select all

TOPIC=devicecoords
DATA={"name": "pippo", "dev": "devicecoords", "ip": "192.168.0.46", "x": 796, "y": 1064, "z": 15008}
E (65788) MQTT_CLIENT: Read error or end of stream
I (65790) MQTT_CLIENT: Reconnect after 10000 ms
I (65795) mqtt: MQTT_EVENT_DISCONNECTED
E (65801) MQTT_CLIENT: Client has not connected
This is a limit of espmqtt?

Thanks.
Regards.

Stefano

chrismerck
Posts: 76
Joined: Tue May 29, 2018 8:00 pm

Re: Problem with espmqtt...

Postby chrismerck » Mon Jun 18, 2018 8:45 pm

I've had that same problem.

Sounds like you are running out of stack, or possibly out of buffer inside espmqtt.

Run "make menuconfig", navigate to:

→ Component config → ESPMQTT Configurations

And try cranking up the buffer and stack size:

(10000) Default MQTT Buffer Size
(10000) MQTT task stack size

Then try increasing your stack size on your FreeRTOS task that is actually calling the espmqtt functions:

xTaskCreate(my_task, "somename", 20000, NULL, 1, NULL);

Let us know how it goes!

stefanoxjx
Posts: 25
Joined: Mon Feb 12, 2018 6:26 pm

Re: Problem with espmqtt...

Postby stefanoxjx » Tue Jun 19, 2018 7:21 pm

Hi, many thanks for your help.
With your tricks the situation is mutch improved, but often I see this:

Code: Select all

E (17244) MQTT_CLIENT: Error write data or timeout, written len = -1
E (17256) MQTT_CLIENT: Error to public data to topic=30aea419630c, qos=0
E (17249) MQTT_CLIENT: Read error or end of stream
I (17269) MQTT_CLIENT: Reconnect after 10000 ms
I (17274) mqtt: MQTT_EVENT_DISCONNECTED
E (17274) MQTT_CLIENT: Client has not connected
E (17286) MQTT_CLIENT: Client has not connected
suggestions?
Thanks.
Regards.

Stefano

chrismerck
Posts: 76
Joined: Tue May 29, 2018 8:00 pm

Re: Problem with espmqtt...

Postby chrismerck » Fri Jun 22, 2018 1:30 pm

You may be hitting a bug in the library. We had better luck after using this PR from github user "oldgreen":

https://github.com/tuanpmt/espmqtt/pull/36

If that fails, try stepping through the code with JTAG debugger to understand better what is going on.

Who is online

Users browsing this forum: Majestic-12 [Bot] and 135 guests