ESP-Mesh-Lite and iot-reference-esp32 / esp-aws-iot

schuyler_tpe
Posts: 3
Joined: Mon Nov 04, 2024 12:06 am

ESP-Mesh-Lite and iot-reference-esp32 / esp-aws-iot

Postby schuyler_tpe » Mon Nov 04, 2024 12:25 am

I'm attempting to modify the iot-reference-esp32 project to use esp-mesh-lite. I got iot-reference-esp32 working on a ESP32-C6-DevKitC-1 V1.2. I then attempted to modify that project to use esp-mesh-lite. With a single node, the mesh-lite project works fine. However when I turn on 2 nodes, the mesh is created but the network connections keep closing and reconnecting. I verified that it does create a mesh - I can see that one of the nodes is Level 1 with one child and the other is Level 2. But the constant network disconnection means messages are dropped and delayed.

Below is a typical output as one of the nodes publishes to a topic once every 5 seconds. I see the same behavior with QoS 0 or 1. Please let me know if you have any ideas for me try, or how to get additional debugging information out. Thank you.
I (40633) core_mqtt_agent_manager: TLS connection established.
I (40993) coreMQTT: MQTT connection established with the broker.
I (40993) core_mqtt_agent_manager: Session present: 1

I (40993) core_mqtt_agent_manager: coreMQTT-Agent connected.
I (40993) mqtt_pub_network_info: coreMQTT-Agent connected.
E (42383) network_transport: Connection closed
E (42383) coreMQTT: Call to receiveSingleIteration failed. Status=MQTTRecvFailed
I (42393) core_mqtt_agent_manager: coreMQTT-Agent disconnected.
I (42393) mqtt_pub_network_info: coreMQTT-Agent disconnected. Preventing coreMQTT-Agent commands from being enqueued.
I (42423) core_mqtt_agent_manager: TLS connection was disconnected.
I (43473) core_mqtt_agent_manager: TLS connection established.
I (43963) coreMQTT: MQTT connection established with the broker.
I (43963) core_mqtt_agent_manager: Session present: 1

I (43963) core_mqtt_agent_manager: coreMQTT-Agent connected.
I (43973) mqtt_pub_network_info: coreMQTT-Agent connected.
I (43983) mqtt_pub_network_info: Sending publish request to agent with message "{"mesh-info":{ "level": "2","children":{}}}" on topic "/f0:f5:bd:0e:5b:e8/networkinfo"
I (43993) mqtt_pub_network_info: Task networkinfo waiting for publish 0 to complete.
I (44093) mqtt_pub_network_info: Rx'ed completion notification for QoS0 publish from Tx to /f0:f5:bd:0e:5b:e8/networkinfo (P5:F0).
E (45193) network_transport: Connection closed
E (45193) coreMQTT: Call to receiveSingleIteration failed. Status=MQTTRecvFailed
I (45193) core_mqtt_agent_manager: coreMQTT-Agent disconnected.
I (45193) mqtt_pub_network_info: coreMQTT-Agent disconnected. Preventing coreMQTT-Agent commands from being enqueued.
I (45223) core_mqtt_agent_manager: TLS connection was disconnected.
I (46293) core_mqtt_agent_manager: TLS connection established.
I (46733) coreMQTT: MQTT connection established with the broker.

schuyler_tpe
Posts: 3
Joined: Mon Nov 04, 2024 12:06 am

Re: ESP-Mesh-Lite and iot-reference-esp32 / esp-aws-iot

Postby schuyler_tpe » Mon Nov 04, 2024 5:55 pm

A few clarifications: I can run the EPS-MESH-LITE example (mesh_local_provisioning) without any issue and I can run the IOT-REFERENCE-ESP32 reference with regular Wi-Fi without any problems or with a single node in mesh mode.

Is there something in the way MESH-LITE works that prevents the TLS / coreMQTT from working properly?

wemaxon
Posts: 2
Joined: Wed Jan 10, 2024 3:45 pm

Re: ESP-Mesh-Lite and iot-reference-esp32 / esp-aws-iot

Postby wemaxon » Tue Nov 05, 2024 4:20 pm

Hi,

i was having a similiar issue using the ESP-MQTT implementation with a mosquitto broker over Wifi-Mesh-Lite. The nodes did connect and form the mesh successfully but sometimes the connection to the MQTT Broker kept being periodically reset. It seems to me like this happened on reconfiguration of the mesh topology. Sometimes it worked but sometimes the devices kept reconnecting from different ports which made the connection very unreliable.

To narrow down the issue i downloaded the mesh_local_control example and replaced the TCP client by as simple MQTT client and the continuing resets seem to have stopped. They only happen now if a node connects or disconnects or the mesh changes its topology.

I am using esp-idf-v5.3.1 and esp-mesh-lite v1.0.0.

Below is the verbose output of the mosquitto broker during the connection resets:

Code: Select all

1730812594: Received PINGREQ from ESP32_e22A28
1730812594: Sending PINGRESP to ESP32_e22A28
1730812598: New connection from 192.168.100.147:61306 on port 1883.
1730812598: Client ESP32_47FCAC already connected, closing old connection.
1730812598: New client connected from 192.168.100.147:61306 as ESP32_47FCAC (p2, c1, k120).
1730812598: No will message specified.
1730812598: Sending CONNACK to ESP32_47FCAC (0, 0)
1730812598: New connection from 192.168.100.147:53031 on port 1883.
1730812598: Client ESP32_4a51C4 already connected, closing old connection.
1730812598: New client connected from 192.168.100.147:53031 as ESP32_4a51C4 (p2, c1, k120).
1730812598: No will message specified.
1730812598: Sending CONNACK to ESP32_4a51C4 (0, 0)
1730812601: New connection from 192.168.100.147:61307 on port 1883.
1730812601: Client ESP32_47FCAC already connected, closing old connection.
1730812601: New client connected from 192.168.100.147:61307 as ESP32_47FCAC (p2, c1, k120).
1730812601: No will message specified.
1730812601: Sending CONNACK to ESP32_47FCAC (0, 0)
1730812601: New connection from 192.168.100.147:53032 on port 1883.
1730812601: Client ESP32_4a51C4 already connected, closing old connection.
1730812601: New client connected from 192.168.100.147:53032 as ESP32_4a51C4 (p2, c1, k120).
1730812601: No will message specified.
1730812601: Sending CONNACK to ESP32_4a51C4 (0, 0)
1730812603: Received PUBLISH from ESP32_e22A28 (d0, q0, r0, m0, 'RAW/clicklux/7c:df:a1:e2:2a:28/status/netinfo', ... (181 bytes))
1730812608: New connection from 192.168.100.147:61308 on port 1883.
1730812608: Client ESP32_47FCAC already connected, closing old connection.
1730812608: New client connected from 192.168.100.147:61308 as ESP32_47FCAC (p2, c1, k120).
1730812608: No will message specified.
1730812608: Sending CONNACK to ESP32_47FCAC (0, 0)
1730812608: New connection from 192.168.100.147:53033 on port 1883.
1730812608: Client ESP32_4a51C4 already connected, closing old connection.
1730812608: New client connected from 192.168.100.147:53033 as ESP32_4a51C4 (p2, c1, k120).
1730812608: No will message specified.
1730812608: Sending CONNACK to ESP32_4a51C4 (0, 0)
1730812608: Received SUBSCRIBE from ESP32_47FCAC
1730812608: 	RAW/clicklux/f4:12:fa:47:fc:ac/command/# (QoS 0)
1730812608: ESP32_47FCAC 0 RAW/clicklux/f4:12:fa:47:fc:ac/command/#
1730812608: Sending SUBACK to ESP32_47FCAC
1730812608: Received SUBSCRIBE from ESP32_4a51C4
1730812608: 	RAW/clicklux/f4:12:fa:4a:51:c4/command/# (QoS 0)
1730812608: ESP32_4a51C4 0 RAW/clicklux/f4:12:fa:4a:51:c4/command/#
1730812608: Sending SUBACK to ESP32_4a51C4
1730812608: Received PUBLISH from ESP32_4a51C4 (d0, q0, r0, m0, 'RAW/clicklux/f4:12:fa:4a:51:c4/status/netinfo', ... (104 bytes))
1730812608: Received PUBLISH from ESP32_47FCAC (d0, q0, r0, m0, 'RAW/clicklux/f4:12:fa:47:fc:ac/status/netinfo', ... (104 bytes))
And the esp log during the connection resets:

Code: Select all

I (433857) mqtt_agent: MQTT_EVENT_BEFORE_CONNECT
E (433897) mqtt_client: esp_mqtt_handle_transport_read_error: transport_read(): EOF
E (433897) mqtt_client: esp_mqtt_handle_transport_read_error: transport_read() error: errno=128
E (433904) mqtt_agent: MQTT_EVENT_ERROR
E (433908) mqtt_client: mqtt_process_receive: mqtt_message_receive() returned -2
I (433901) mqtt_agent: MQTT_EVENT_CONNECTED
E (433922) mqtt_client: Client has not connected

schuyler_tpe
Posts: 3
Joined: Mon Nov 04, 2024 12:06 am

Re: ESP-Mesh-Lite and iot-reference-esp32 / esp-aws-iot

Postby schuyler_tpe » Tue Nov 05, 2024 9:14 pm

Issue solved: Multiple nodes had the same ThingName set in menuconfig. Once each node had a unique ThingName, the issue stopped occuring.

Who is online

Users browsing this forum: Google [Bot] and 93 guests