espressif / esp-idf

Espressif IoT Development Framework. Official development framework for Espressif SoCs.
Apache License 2.0
13.78k stars 7.31k forks source link

System Crash with WiFi and Bluetooth (Client & Server) Enabled - Assertion Error in llc_disconnect.c 363 (IDFGH-13512) #14404

Open matreshka15 opened 2 months ago

matreshka15 commented 2 months ago

Answers checklist.

IDF version.

5.1.4

Espressif SoC revision.

ESP32-S3 (QFN56) (revision v0.2)

Operating System used.

Windows

How did you build your project?

VS Code IDE

If you are using Windows, please specify command line type.

None

Development Kit.

Custom Board

Power Supply used.

Battery

What is the expected behavior?

Enable both WiFi and Bluetooth, with Bluetooth operating in both client and server modes. ESP32S3 should connect to other server devices smoothly.

What is the actual behavior?

Enable both WiFi and Bluetooth, with Bluetooth operating in both client and server modes, my system sometimes crashes when ESP32S3 trys to connect to one of the two server devices with the following error: assert llc_disconnect.c 363, param 00000004 00000009

This error leads to a system crash, and I have not been able to identify the root cause. I have tried various configurations, but the problem persists.

Steps to reproduce.

  1. Enable Bluetooth in both client and server modes.
  2. Configure and connect the WiFi to a network.
  3. Make sure ESP32S3 is trying to connect to a server devices
  4. With some possibility, the system crashes.

Debug Logs.

[I][BTC_TASK][1] connecting to dev: 00:80:e1:26:17:1b
W (30361) BT_GATT: gatt_connect wrong state 2
[I][BTC_TASK][1] stop scan successfully
[D][BTC_TASK][1] GATT_WRITE_EVT, conn_id 1, trans_id 74, handle 118,
[D][BTC_TASK][1] GATT_WRITE_EVT, conn_id 1, trans_id 75, handle 106,
W (30661) BT_HCI: hcif disc complete: hdl 0x4, rsn 0x3e
[D][BTC_TASK][1] GATT_WRITE_EVT, conn_id 1, trans_id 76, handle 127,
[D][BTC_TASK][1] GATT_WRITE_EVT, conn_id 1, trans_id 77, handle 115,
[I]<elbo motor>[BTC_TASK][1] motor stopped at: 107.242
[I]<elbo motor>[BTC_TASK][1] set current_limit: :3000
[D][BTC_TASK][1] GATT_WRITE_EVT, conn_id 1, trans_id 78, handle 139,
[I]<hand mot-ppl>[BTC_TASK][1] Deiniting user model
[I]<hand mot-ppl>[BTC_TASK][1] PPL set user id:1001
assert llc_disconnect.c 363, param 00000004 00000009
log record file write error!: Connection timed out
E (50931) task_wdt: Task watchdog got triggered. The following tasks/users did not reset the watchdog in time:
E (50931) task_wdt:  - IDLE1 (CPU 1)
E (50931) task_wdt: Tasks currently running:
E (50931) task_wdt: CPU 0: IDLE0
E (50931) task_wdt: CPU 1: btController
E (50931) task_wdt: Print CPU 1 backtrace

Backtrace: 0x403854A2:0x3FCAF070 0x4037BD31:0x3FCAF090 0x40006FCD:0x3FCECFF0 0x4000FD0F:0x3FCED010 0x420680BB:0x3FCED030 0x4000D025:0x3FCED060 0x4002C4A5:0x3FCED080 0x4205C6CF:0x3FCED0A0 0x4037EEA3:0x3FCED0C0 0x4037F033:0x3FCED0E0 0x4038E3A1:0x3FCED110
0x403854a2: esp_crosscore_isr at C:/Users/Admin/esp/v5.1.4/esp-idf/components/esp_system/crosscore_int.c:96
0x4037bd31: _xt_lowint1 at C:/Users/Admin/esp/v5.1.4/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/xtensa_vectors.S:1240
0x40006fcd: r_assert_param in ROM
0x4000fd0f: lld_disc_ind_handler in ROM
0x420680bb: r_ke_task_schedule at ??:?
0x4000d025: r_ke_event_schedule in ROM
0x4002c4a5: r_rwip_schedule in ROM
0x4205c6cf: rw_schedule at ??:?
0x4037eea3: ble_try_turn_on_pll_track at ??:?
0x4037f033: btdm_controller_task at ??:?
0x4038e3a1: vPortTaskWrapper at C:/Users/Admin/esp/v5.1.4/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:162

More Information.

In the ESP sdkconfig configuration, # CONFIG_ESP_COEX_SW_COEXIST_ENABLE is not set, in order to decrease wifi transmitting delay.

If enabled, WiFi & Bluetooth coexistence is controlled by software rather than hardware. Recommended for heavy traffic scenarios. Both coexistence configuration options are automatically managed, no user intervention is required. If only Bluetooth is used, it is recommended to disable this option to reduce binary file size.

matreshka15 commented 2 months ago

Full sdkconfig: sdkconfig.txt

matreshka15 commented 2 months ago

updates: the server device will actively disconnect, while ESP32S3 trying to connect. Leading to this issue.

esp-zhp commented 2 months ago

@matreshka15 it looks that the connection was already established before create connection,and there is a PHY update onging. However, from the existing logs, I'm still unable to find the root cause. Could you provide me with a demo to reproduce this problem?thanks.

esp-zhp commented 2 months ago

Additionally, does the issue still persist if WiFi is not being used?

esp-zhp commented 2 months ago

In order to further analyze the root cause of the issue, I have added HCI logging. You can apply this patch using the git am command. 0001-add-esp32c3-s3-hci-log.zip