esp-idf
esp-idf copied to clipboard
MQTT and Bluetooth cause crash (IDFGH-12518)
Answers checklist.
- [X] I have read the documentation ESP-IDF Programming Guide and the issue is not addressed there.
- [X] I have updated my IDF branch (master or release) to the latest version and checked that the issue is present there.
- [X] I have searched the issue tracker for a similar issue and not found a similar issue.
IDF version.
5.2.1
Espressif SoC revision.
ESP32-S3
Operating System used.
Windows
How did you build your project?
Command line with Make
If you are using Windows, please specify command line type.
None
Development Kit.
Custom board
Power Supply used.
USB
What is the expected behavior?
Use both BT an MQTT
What is the actual behavior?
If I init bluetooth MQTT will crash the esp32
Steps to reproduce.
If I init BT it will work fine, but when I try to init the MQTT it will crash. MQTT alone works fine.
void bluetooth_init() {
ESP_ERROR_CHECK(esp_bt_controller_mem_release(ESP_BT_MODE_CLASSIC_BT));
esp_bt_controller_config_t bt_cfg = BT_CONTROLLER_INIT_CONFIG_DEFAULT();
ESP_ERROR_CHECK(esp_bt_controller_init(&bt_cfg));
ESP_ERROR_CHECK(esp_bt_controller_enable(ESP_BT_MODE_BLE));
ESP_ERROR_CHECK(esp_bluedroid_init());
ESP_ERROR_CHECK(esp_bluedroid_enable());
ESP_ERROR_CHECK(esp_ble_gap_register_callback(gap_event_handler));
esp_ble_scan_params_t scan_params = {};
scan_params.scan_type = BLE_SCAN_TYPE_PASSIVE;
scan_params.own_addr_type = BLE_ADDR_TYPE_PUBLIC;
scan_params.scan_filter_policy = BLE_SCAN_FILTER_ALLOW_ALL;
scan_params.scan_interval = 0x50;
scan_params.scan_window = 0x30;
scan_params.scan_duplicate = BLE_SCAN_DUPLICATE_DISABLE;
ESP_ERROR_CHECK(esp_ble_gap_set_scan_params(&scan_params));
}
void mqtt_app_start(void) {
const esp_mqtt_client_config_t mqtt_cfg = {
.broker = {
.address={
.uri = "mqtts://test:[email protected]:8883"
},
.verification={
.certificate = (const char *) mqtt_eclipseprojects_io_pem_start
}
},
};
ESP_LOGI(TAG, "[APP] Free memory: %" PRIu32 " bytes", esp_get_free_heap_size());
esp_mqtt_client_handle_t client = esp_mqtt_client_init(&mqtt_cfg);
/* The last argument may be used to pass data to the event handler, in this example mqtt_event_handler */
esp_mqtt_client_register_event(client, MQTT_EVENT_ANY, mqtt_event_handler, NULL);
esp_mqtt_client_start(client);
}
Debug Logs.
Guru Meditation Error: Core 1 panic'ed (LoadProhibited). Exception was unhandled.
Core 1 register dump:
PC : 0x4038238d PS : 0x00060933 A0 : 0x803846a3 A1 : 0x3fcc7460
A2 : 0x100fa0e9 A3 : 0xffffffff A4 : 0x0000abab A5 : 0x00060923
A6 : 0xb33fffff A7 : 0xb33fffff A8 : 0x80382369 A9 : 0x3fcc7460
A10 : 0x00060923 A11 : 0x00000000 A12 : 0x00060920 A13 : 0x3fccfbd0
A14 : 0x00000001 A15 : 0x00000000 SAR : 0x0000001b EXCCAUSE: 0x0000001c
EXCVADDR: 0x100fa0e9 LBEG : 0x40056f5c LEND : 0x40056f72 LCOUNT : 0x00000000
Backtrace: 0x4038238a:0x3fcc7460 0x403846a0:0x3fcc7490 0x40377153:0x3fcc74b0 0x40377493:0x3fcc74e0 0x42088d75:0x3fcc7500 0x4208608d:0x3fcc7520 0x4207bc42:0x3fcc7540 0x4207c524:0x3fcc7560 0x4207c8b2:0x3fcc75f0 0x42089f12:0x3
fcc7620 0x42086844:0x3fcc7680 0x42087776:0x3fcc76b0 0x420877e7:0x3fcc76e0 0x42084d7d:0x3fcc7710 0x420849b1:0x3fcc7740 0x42084a46:0x3fcc7760 0x420941fe:0x3fcc7790 0x42094486:0x3fcc78a0 0x42090979:0x3fcc78d0 0x420917be:0x3fcc
7920 0x4208fa2b:0x3fcc79c0 0x4208fa6c:0x3fcc79e0 0x4204c26a:0x3fcc7a00 0x4204bcf1:0x3fcc7a20 0x4204be2a:0x3fcc7a60 0x4206be30:0x3fcc7aa0 0x420e918d:0x3fcc7ad0 0x42045427:0x3fcc7af0
ELF file SHA256: 9a7a0ac4bb425a13
More Information.
Any ideas why is this happening? Or how to resolve this
The ESP32 chip has four MAC addresses: Station (STA), Access Point (AP), BlueTooth (BT), and Local Area Network (LAN) These can be used at the same time.
I have created a GateWay for MQTT and Bluetooth using esp32. It works correctly.
MQTT--->ESP32--->Bluetooth MQTT<---ESP32<---Bluetooth
However, I have not tried it with ESP32S3+BLE.
(EDIT) I have created a GateWay for MQTT and BLE using esp32s3. It works correctly.
MQTT--->ESP32S3--->BLE MQTT<---ESP32S3<---BLE
@AlexMihai1804 could you provide the logs for the crash and a decoded backtrace, so I can try to identify the issue? Even better if you can provide a reproducer.
@AlexMihai1804 I'm closing this one, feel free to reopen, adding the reproducer.