Bluetooth Classic Handsfree Client strange crash (IllegalInstruction in bt.c)
Posted: Wed Sep 20, 2023 10:06 pm
IDF Version: v4.4.4-439-gc25d92074e
CPU: ESP32 Version 3.0
BT Controller Version: 97e0759
I have a program for a communications device that uses Bluetooth Classic Handsfree Client running on an ESP32. The Bluetooth stack has been reliable in my system. However last night I was logging data from the system and noticed that it crashed with an IllegalInstruction in the ESP bt.c file. I realize there are a lot of variables but does anyone know why this might have occurred? The situation the code was in is pretty common.
A part of the log file is shown below (the crash is at the end). My code is based originally on the Espressif BT HF client demo and I retained the log information for the various callbacks.
CPU: ESP32 Version 3.0
BT Controller Version: 97e0759
I have a program for a communications device that uses Bluetooth Classic Handsfree Client running on an ESP32. The Bluetooth stack has been reliable in my system. However last night I was logging data from the system and noticed that it crashed with an IllegalInstruction in the ESP bt.c file. I realize there are a lot of variables but does anyone know why this might have occurred? The situation the code was in is pretty common.
A part of the log file is shown below (the crash is at the end). My code is based originally on the Espressif BT HF client demo and I retained the log information for the various callbacks.
Code: Select all
I (3271846) bt_task: Found 1 bonded device(s)
I (3271846) bt_task: Attempting to connect to Dan’s iPhone:
I (3271846) bt_task: fc aa 81 f1 0c 86
W (3271846) BT_APPL: HF Client found collision (RFCOMM) ...
W (3273896) BT_HCI: hcif mode change: hdl 0x81, mode 0, intv 0, status 0xc
E (3273896) BT_APPL: bta_dm_pm_btm_status hci_status=12
I (3273906) bt_gap: ESP_BT_GAP_MODE_CHG_EVT mode:0
W (3273966) BT_HCI: hcif disc complete: hdl 0x81, rsn 0x22
W (3276646) BT_HCI: hcif conn complete: hdl 0x81, st 0x0
I (3276646) bt_gap: event: 16
E (3278036) BT_BTM: tBTM_SEC_DEV:0x3ffe3ac4 rs_disc_pending=0
W (3278066) BT_HCI: hcif link supv_to changed: hdl 0x81, supv_to 32000
W (3278076) BT_HCI: hcif link supv_to changed: hdl 0x81, supv_to 8000
W (3278136) BT_APPL: new conn_srvc id:27, app_id:1
W (3278136) BT_APPL: bta_dm_pm_ssr conn_srvc id:27, app_id:1
W (3278136) BT_APPL: bta_dm_pm_ssr:2, lat:1200
I (3278136) bt_hf: APP HFP event: CONNECTION_STATE_EVT
I (3278146) bt_hf: --connection state connected, peer feats 0x0, chld_feats 0x0
I (3278256) bt_hf: APP HFP event: NETWORK_STATE_EVT
I (3278256) bt_hf: --NETWORK STATE available
I (3278256) bt_hf: APP HFP event: CALL_IND_EVT
I (3278266) bt_hf: --Call indicator NO call in progress
I (3278266) bt_hf: APP HFP event: CALL_SETUP_IND_EVT
I (3278276) bt_hf: --Call setup indicator NONE
I (3278276) bt_hf: APP HFP event: BATTERY_LEVEL_IND_EVT
I (3278286) bt_hf: --battery level 5
I (3278286) bt_hf: APP HFP event: SIGNAL_STRENGTH_IND_EVT
I (3278296) bt_hf: -- signal strength: 1
I (3278296) bt_hf: APP HFP event: ROAMING_STATUS_IND_EVT
I (3278306) bt_hf: --ROAMING: inactive
I (3278316) bt_hf: APP HFP event: CALL_HELD_IND_EVT
I (3278316) bt_hf: --Call held indicator NONE held
I (3278326) bt_hf: APP HFP event: CONNECTION_STATE_EVT
I (3278326) bt_hf: --connection state slc_connected, peer feats 0xfef, chld_feats 0x3f
I (3278336) bt_hf: APP HFP event: INBAND_RING_TONE_EVT
I (3278346) bt_hf: --inband ring state Provided
I (3278346) bt_task: DISCONNECTED->CONNECTED-IDLE
I (3278396) app_task: DISCONNECTED->CONNECTED_IDLE
W (3285336) BT_HCI: hci cmd send: sniff: hdl 0x81, intv(400 800)
I (3301946) gcore_task: Vusb: 5.10v, Iusb: 235mA, Vbatt: 4.18v, Iload: 236mA, Chg: 2
E (3308276) BT_APPL: HFPClient: AT response timeout, disconnecting
W (3311276) BT_RFCOMM: port_rfc_closed RFCOMM connection in server:0 state 3 closed: Closed (res: 19)
W (3311276) BT_APPL: BTA_HF_CLIENT_SCO_SHUTDOWN_ST: Ignoring event 3
I (3311286) bt_hf: APP HFP event: CONNECTION_STATE_EVT
I (3311286) bt_hf: --connection state disconnected, peer feats 0x0, chld_feats 0x0
I (3311296) bt_task: CONNECTED-IDLE->DISCONNECTED
I (3311326) bt_task: Found 1 bonded device(s)
I (3311326) bt_task: Attempting to connect to Dan’s iPhone:
I (3311326) bt_task: fc aa 81 f1 0c 86
W (3311326) BT_APPL: HF Client found collision (RFCOMM) ...
I (3311346) app_task: CONNECTED_IDLE->DISCONNECTED
ASSERT_PARAM(-218959118 0), in arch_main.c at line 369
Guru Meditation Error: Core 0 panic'ed (IllegalInstruction). Exception was unhandled.
Memory dump at 0x40091590: f01d092d 00004136 f01d0000
0x40091590: btdm_sleep_check_duration at /Users/danjulio/esp/esp-idf-v4.4/components/bt/controller/esp32/bt.c:954
Core 0 register dump:
PC : 0x40091597 PS : 0x00060934 A0 : 0x80085381 A1 : 0x3ffc0e70
0x40091597: r_assert at /Users/danjulio/esp/esp-idf-v4.4/components/bt/controller/esp32/bt.c:1889
A2 : 0x00000000 A3 : 0xf2f2f2f2 A4 : 0x00000000 A5 : 0x3f43cbd0
A6 : 0x00000171 A7 : 0xfffffffc A8 : 0x8000814b A9 : 0x3ffc0de0
A10 : 0x00000000 A11 : 0x3ffc0e03 A12 : 0x3ffc0daf A13 : 0x00000039
A14 : 0x00000000 A15 : 0x3ffc0db4 SAR : 0x00000004 EXCCAUSE: 0x00000000
EXCVADDR: 0x00000000 LBEG : 0x40085289 LEND : 0x40085291 LCOUNT : 0x00000000
0x40085289: r_assert_param at ??:?
0x40085291: r_assert_param at ??:?
Backtrace: 0x40091594:0x3ffc0e70 0x4008537e:0x3ffc0e90 0x4012f221:0x3ffc0eb0 0x40019fb5:0x3ffc0ed0 0x4001a1f2:0x3ffc0f00 0x4001a282:0x3ffc0f20 0x40032b55:0x3ffc0f40 0x400875f5:0x3ffc0f80 0x400878cd:0x3ffc0fa0 0x4008b7f2:0x3ffc0fd0 0x4008c2bb:0x3ffc0ff0 0x40084ac1:0x3ffc1010 0x40084a2d:0x3ffc1030 0x40084a0f:0x00000000 |<-CORRUPTED
0x40091594: r_assert at /Users/danjulio/esp/esp-idf-v4.4/components/bt/controller/esp32/bt.c:1888
0x4008537e: r_assert_param at ??:?
0x4012f221: r_platform_reset at ??:?
0x400875f5: ld_acl_frm_isr at ??:?
0x400878cd: r_ld_fm_frame_isr at ??:?
0x4008b7f2: r_rwbt_isr at ??:?
0x4008c2bb: r_rwbtdm_isr_wrapper at intc.c:?
0x40084ac1: hli_c_handler at /Users/danjulio/esp/esp-idf-v4.4/components/bt/controller/esp32/hli_api.c:101
0x40084a2d: _highint4_stack_switch at /Users/danjulio/esp/esp-idf-v4.4/components/bt/controller/esp32/hli_vectors.S:185
0x40084a0f: xt_highint4 at /Users/danjulio/esp/esp-idf-v4.4/components/bt/controller/esp32/hli_vectors.S:169