Hi everyone,
I’m trying to run the ESP-IDF MQTT over TLS (mqtts) example, but the MQTT connection fails even though Wi-Fi connects successfully and the device gets an IP address.
Wi-Fi connection works fine (IPv4 + IPv6 assigned), but the MQTT client fails during the TLS connection phase.
Here is the relevant log output:
I (2599) example_connect: Got IPv6 event: Interface "example_netif_sta" address: fe80:0000:0000:0000:861f:e8ff:fe07:c1f8, type: ESP_IP6_ADDR_IS_LINK_LOCAL
I (3219) esp_netif_handlers: example_netif_sta ip: 192.168.0.115, mask: 255.255.255.0, gw: 192.168.0.1
I (3219) example_connect: Got IPv4 event: Interface "example_netif_sta" address: 192.168.0.115
I (3229) example_common: Connected to example_netif_sta
I (3229) example_common: - IPv4 address: 192.168.0.115,
I (3239) example_common: - IPv6 address: fe80:0000:0000:0000:861f:e8ff:fe07:c1f8, type: ESP_IP6_ADDR_IS_LINK_LOCAL
I (3249) mqtts_example: [APP] Free memory: 229736 bytes
I (3259) mqtts_example: Other event id:7
I (3259) main_task: Returned from app_main()
I (3629) wifi:<ba-add>idx:1 (ifx:0, dc:62:79:a7:29:da), tid:6, ssn:0, winSize:64
I (5559) wifi:<ba-del>idx:0, tid:5
I (5569) wifi:<ba-add>idx:0 (ifx:0, dc:62:79:a7:29:da), tid:0, ssn:1, winSize:64
E (13619) esp-tls: [sock=54] select() timeout
E (13619) esp-tls: Failed to open new connection
E (13619) transport_base: Failed to open a new connection
E (13619) mqtt_client: Error transport connect
I (13629) mqtts_example: MQTT_EVENT_ERROR
I (13629) mqtts_example: Last error code reported from esp-tls: 0x8006
I (13639) mqtts_example: Last tls stack error number: 0x0
I (13639) mqtts_example: Last captured errno : 0 (Success)
I (13649) mqtts_example: MQTT_EVENT_DISCONNECTED
I (23659) mqtts_example: Other event id:7
How to send data using MQTT over TLS with certificates in ESP-IDF?
ESP-IDF MQTT over TLS example fails with esp-tls select() timeout after Wi-Fi connects
-
nopnop2002
- Posts: 347
- Joined: Thu Oct 03, 2019 10:52 pm
- Contact:
Re: ESP-IDF MQTT over TLS example fails with esp-tls select() timeout after Wi-Fi connects
You must replace it with the latest certificate.
You can get the certificates with the following command:
You can get the certificates with the following command:
Code: Select all
HOST="broker.emqx.io"
PORT="8883"
openssl s_client -showcerts -connect $HOST:$PORT </dev/null >hoge
start=`grep -e "-----BEGIN CERTIFICATE-----" -n hoge | sed -e 's/:.*//g' | tail -n 1`
last=`grep -e "-----END CERTIFICATE-----" -n hoge | sed -e 's/:.*//g' | tail -n 1`
sed -n ${start},${last}p hoge
Who is online
Users browsing this forum: Baidu [Spider], ChatGPT-User, Google [Bot], Perplexity-User, PetalBot and 5 guests