Hi, I developed a custom board based on ESP32-WROOM-32D and our software had been freezed for a while after working successfully for two years. Now I decided to update it to the last ESP-IDF available. I am doing it step by step so first of all I am trying with ESP-IDF 4.1 but unfortunately I am facing an issue that has been consuming a lot of effort recently and so far I have not been able to make it work.
We are using ESP-AZURE (last version available).
I can start Wi-Fí in both, station and ap modes successfully but the problem comes when I disconnect and then connect again, where I am receiving an error and the ESP is restarting. It only happens when the connection to the IoT Hub in Azure has been stablished (TLS). If the board is connected to Wi-Fi but not to the IoT Hub, the connection/disconnection process works just fine.
When I connect to Wi-Fi and then to the IoT Hub, I can see an error: "Error from SSL_write: 0" although then it seems to work just fine and data is beeing sent and received correctly.
When I connect I do:
main.c:
esp_netif_init();
esp_event_loop_create_default();
wifi_comm.c:
Connect function
netif_station = esp_netif_create_default_wifi_sta();
wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
ESP_ERROR_CHECK(esp_wifi_init(&cfg));
ESP_ERROR_CHECK(esp_wifi_get_config(ESP_IF_WIFI_STA, &wifi_config));
ESP_ERROR_CHECK(esp_event_handler_register(WIFI_EVENT, ESP_EVENT_ANY_ID, &event_handler, NULL));
ESP_ERROR_CHECK(esp_event_handler_register(IP_EVENT, IP_EVENT_STA_GOT_IP, &event_handler, NULL));
ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_STA));
ESP_ERROR_CHECK(esp_wifi_set_config(WIFI_IF_STA, &wifi_config));
ESP_ERROR_CHECK(esp_wifi_start());
Disconnect function
DisconnectIotHub(); // two steps --> 1. IoTHubDeviceClient_LL_Destroy(iotHubClientHandle); 2. IoTHub_Deinit();
esp_wifi_disconnect();
esp_wifi_stop();
esp_wifi_deinit();
esp_wifi_clear_default_wifi_driver_and_handlers(netif_station);
esp_netif_destroy(netif_station);
When I disconnect, I can see the following error:
E (314671) esp-tls-mbedtls: write error :-78:
Info: Error from SSL_write: -78
And then if I try to connect again (Wi-Fi and IoT Hub):
Error: Time:Wed Dec 7 06:41:49 2022 File:C:/...../esp-azure/port/src/tlsio_esp_tls.c Func:tlsio_esp_tls_destroy Line:152 tlsio_esp_tls_destroy called while not in TLSIO_STATE_CLOSED.
Guru Meditation Error: Core 0 panic'ed (InstrFetchProhibited). Exception was unhandled.
Core 0 register dump:
PC : 0x00000000 PS : 0x00060b30 A0 : 0x8010ccf0 A1 : 0x3ffd8050
A2 : 0x3ffc9aa8 A3 : 0x3ffc9476 A4 : 0x0000005a A5 : 0x3ffc93e4
A6 : 0x0000be1a A7 : 0x00000000 A8 : 0x8019c6c8 A9 : 0x00000064
A10 : 0x00000000 A11 : 0x3ffc9476 A12 : 0x0000005a A13 : 0x3ffc93e4
A14 : 0x3ffc8ad4 A15 : 0xffffffff SAR : 0x00000010 EXCCAUSE: 0x00000014
EXCVADDR: 0x00000000 LBEG : 0x4000c2e0 LEND : 0x4000c2f6 LCOUNT : 0xffffffff
ELF file SHA256: f4248fb42d819f8f
Backtrace: 0xfffffffd:0x3ffd8050 |<-CORRUPTED
Rebooting...
It seems to be a problem with TLS and not related to ESP-IDF, but I am completly lost... ESP-AZURE repo seems to be dead, with no updates and no solutions to the open issues so I hope someone here can help. This same procedure worked just fine with ESP-IDF 4.0.1
Thanks in advance
Problems migrating from tcpip_adapter to netif
Jump to
- English Forum
- Explore
- News
- General Discussion
- FAQ
- Documentation
- Documentation
- Sample Code
- Discussion Forum
- ESP32-S31
- Hardware
- ESP-IDF
- ESP-BOX
- ESP-ADF
- ESP-MDF
- ESP-WHO
- ESP-SkaiNet
- ESP32 Arduino
- IDEs for ESP-IDF
- ESP-AT
- ESP IoT Solution
- ESP RainMaker
- Rust
- ESP8266
- Report Bugs
- Showcase
- Chinese Forum 中文社区
- 活动区
- 乐鑫活动专区
- 讨论区
- ESP32-S31 中文讨论版
- 喵伴 中文讨论版
- ESP-IDF 中文讨论版
- 《ESP32-C3 物联网工程开发实战》书籍讨论版
- 中文文档讨论版
- ESP-AT 中文讨论版
- ESP-BOX 中文讨论版
- ESP IoT Solution 中文讨论版
- ESP-ADF 中文讨论版
- ESP Mesh 中文讨论版
- ESP Cloud 中文讨论版
- ESP-WHO 中文讨论版
- ESP-SkaiNet 中文讨论版
- ESP 生产支持讨论版
- 硬件问题讨论
- 项目展示
Who is online
Users browsing this forum: Baidu [Spider], ChatGPT-User and 3 guests
- All times are UTC
- Top
- Delete cookies
About Us
Espressif Systems is a fabless semiconductor company providing cutting-edge low power WiFi SoCs and wireless solutions for wireless communications and Internet of Things applications. ESP8266EX and ESP32 are some of our products.
Information
Espressif ESP32 ... Available now!