ESP-MDF mqtt_example not routing WLAN traffic
Posted: Thu Nov 19, 2020 2:37 am
I have started working with the ESP32 Mesh kits and ran into a problem that has me stuck after a couple days of trying to troubleshoot the root cause. First the details of the source code and test environment:
Source code https://github.com/espressif/esp-mdf
release/v1.0 of esp-mdf @ 51a070c
esp-mdf master @ e0acefd, which references esp-idf @ bf02206
I have been using several ESP32 development boards and they are exhibiting the same behavior and this may just be a configuration issue.
I am using a Mosquitto MQTT broker with no authentication over TCP on an Ubuntu 20.04 desktop system for ESP32 compilation.
I reference the MQTT broker by IP address 192.168.4.115:1883 instead of a DNS name.
I have a dedicated access point going through a hub that I can sniff all WLAN network traffic for these experiments.
When I compile and run the esp-mdf/esp-idf/examples/protocols/mqtt/tcp/ example, everything works as expected using esp-mdf master. I see the following traffic:
However, as soon as I try to use the ESP-MDF MWIFI MQTT example at esp-mdf/examples/function_demo/mwifi/mqtt_example, I am able to have my ESP32 devices mesh but I am unable to have the root node's MQTT or DNS requests reach the WLAN. I have tried the following variations in the config: mqtt://192.168.4.115, mqtt://129.168.4.115:1883, and also leaving the default mqtt://iot.eclipse.org value.
This happened on both the master branch of esp-mdf referenced as well as the release/1.0 branch referenced.
Notice, nothing other than DHCP and ARP traffic is making it on to the WLAN.
I played around with the esp_mqtt_client_config_t by directly specifying the host/port instead of the URL with the same results.
In the end, this does not appear to me as a MQTT issue but more of an LWIP or similar configuration issue. I have tried this with the defaults other than the example config settings so I'm hoping that someone has some things that I can test and hopefully get a successful network connection on my WLAN.
Thank you in advance for your help!
Source code https://github.com/espressif/esp-mdf
release/v1.0 of esp-mdf @ 51a070c
esp-mdf master @ e0acefd, which references esp-idf @ bf02206
I have been using several ESP32 development boards and they are exhibiting the same behavior and this may just be a configuration issue.
I am using a Mosquitto MQTT broker with no authentication over TCP on an Ubuntu 20.04 desktop system for ESP32 compilation.
I reference the MQTT broker by IP address 192.168.4.115:1883 instead of a DNS name.
I have a dedicated access point going through a hub that I can sniff all WLAN network traffic for these experiments.
When I compile and run the esp-mdf/esp-idf/examples/protocols/mqtt/tcp/ example, everything works as expected using esp-mdf master. I see the following traffic:
However, as soon as I try to use the ESP-MDF MWIFI MQTT example at esp-mdf/examples/function_demo/mwifi/mqtt_example, I am able to have my ESP32 devices mesh but I am unable to have the root node's MQTT or DNS requests reach the WLAN. I have tried the following variations in the config: mqtt://192.168.4.115, mqtt://129.168.4.115:1883, and also leaving the default mqtt://iot.eclipse.org value.
This happened on both the master branch of esp-mdf referenced as well as the release/1.0 branch referenced.
Code: Select all
From release/v1.0 of esp-mdf 51a070c
I (111619) [mdf_mem, 129]: Memory record, num: 4, size: 3116
E (115224) MQTT_CLIENT: Error transport connect
D (115224) [mesh_mqtt, 216]: MQTT_EVENT_ERROR
D (115224) [mesh_mqtt, 178]: MQTT_EVENT_DISCONNECTED
I (115228) [mqtt_examples, 236]: event_loop_cb, event: 24578
Code: Select all
esp-mdf master e0acefd
I (131603) [mdf_mem, 129]: Memory record, num: 4, size: 3120
E (131750) TRANS_TCP: DNS lookup failed err=202 res=0x0
E (131751) MQTT_CLIENT: Error transport connect
D (131751) [mesh_mqtt, 216]: MQTT_EVENT_ERROR
D (131755) [mesh_mqtt, 178]: MQTT_EVENT_DISCONNECTED
I played around with the esp_mqtt_client_config_t by directly specifying the host/port instead of the URL with the same results.
In the end, this does not appear to me as a MQTT issue but more of an LWIP or similar configuration issue. I have tried this with the defaults other than the example config settings so I'm hoping that someone has some things that I can test and hopefully get a successful network connection on my WLAN.
Thank you in advance for your help!