MQTT TLS over ESP32 WiFi Mesh esp-tls-mbedtls: read error :-0x7180

MichaelS
Posts: 46
Joined: Mon Jul 08, 2024 12:08 am

MQTT TLS over ESP32 WiFi Mesh esp-tls-mbedtls: read error :-0x7180

Postby MichaelS » Mon Jul 21, 2025 6:52 am

I have an ESP32 project using MQTTS (TLS) through a Mesh network.

Everything use to work and I tested it with Eclipse Mosquito both TCP and TLS and HIVEHQ over TLS.

I was working on other aspects of the project for a while using a local LAN installation Eclipse Mosquitto over TCP. During this time I upgraded to the latest IDF ver 5.5.0

Now I have switched back to a cloud web broker using TLS I am having problems. I have tried HiveMQ and broker.emqx.io. They both give the same result. I cannot retest on the Eclipse test cloud Broker as the mqtt.eclipseprojects.io seems to have been decommissioned.

The WiFi MESH_ROOT node works perfectly with MQTT over TLS. But my MESH_NODEs keep getting intermittent errors. Some messages are received successfully but I get lots of errors as follows:

Code: Select all

E (17:37:11.861) esp-tls-mbedtls: read error :-0x7180
E (17:37:11.862) transport_base: esp_tls_conn_read error, errno=Connection already in progress
E (17:37:11.864) mqtt_client: esp_mqtt_handle_transport_read_error: transport_read() error: errno=119
E (17:37:11.866) aMQTT: MQTT_EVENT_ERROR
E (17:37:11.867) aMQTT: MQTT5 return code is 0
E (17:37:11.868) aMQTT: Last error reported from tls stack: 0x7180
E (17:37:11.869) aMQTT: Last errno string (Success)
E (17:37:11.870) mqtt_client: mqtt_process_receive: mqtt_message_receive() returned -2
I can't find an ESP IDF documentation on Error code 0x7180. Espressif v5.5 documentation Error code reference skips from 0x700a to 0x8000

I found some articles on Google defining this as MBEDTLS_ERR_SSL_INVALID_MAC which sounds relevant.

I am wondering if it might be to do with the max message length which can be sent through the WiFi Mesh network (1460 bytes) and maybe my sdkconfig is the issue. It contains:

Code: Select all

# mbedTLS
#
# CONFIG_MBEDTLS_INTERNAL_MEM_ALLOC is not set
# CONFIG_MBEDTLS_EXTERNAL_MEM_ALLOC is not set
CONFIG_MBEDTLS_DEFAULT_MEM_ALLOC=y
# CONFIG_MBEDTLS_CUSTOM_MEM_ALLOC is not set
CONFIG_MBEDTLS_ASYMMETRIC_CONTENT_LEN=y
CONFIG_MBEDTLS_SSL_IN_CONTENT_LEN=16384
CONFIG_MBEDTLS_SSL_OUT_CONTENT_LEN=4096
CONFIG_MBEDTLS_DYNAMIC_BUFFER=y
# CONFIG_MBEDTLS_DYNAMIC_FREE_CONFIG_DATA is not set
# CONFIG_MBEDTLS_DEBUG is not set
Does anyone have any ideas on what my problem might be and what the solution is, or how I might go about debugging it.

Thanks
sdkconfig.txt
Renamed to .txt
(83.95 KiB) Downloaded 7 times

Who is online

Users browsing this forum: Bytespider, PerplexityBot, PetalBot, Qwantbot and 11 guests