Call to esp_bt_gap_config_eir_data results in LoadProhibited kernal panic

tomasmcguinness
Posts: 6
Joined: Thu Jul 18, 2019 9:20 pm

Call to esp_bt_gap_config_eir_data results in LoadProhibited kernal panic

Postby tomasmcguinness » Sat May 09, 2020 8:04 am

I am trying to create an LED clock which integrates with Amazon Alexa using the Gadget Toolkit. I'm using Classic Bluetooth. One of the first steps is the return of an EIR record, with custom payload (https://developer.amazon.com/en-US/docs ... tings.html).

When I call esp_bt_gap_config_eir_data to configure the payload, it results in a kernal panic.

Guru Meditation Error: Core 0 panic'ed (LoadProhibited). Exception was unhandled.
Core 0 register dump:
PC : 0x4000c330 PS : 0x00060130 A0 : 0x800d69f4 A1 : 0x3ffbcd60
A2 : 0x3ffba39c A3 : 0x02001e00 A4 : 0x00000001 A5 : 0x3ffba39c
A6 : 0x00000000 A7 : 0x00000000 A8 : 0x00000000 A9 : 0x3ffbcd30
A10 : 0x3ffba39c A11 : 0x00001800 A12 : 0x3ffb63ec A13 : 0x00000000
A14 : 0x00000000 A15 : 0x00000000 SAR : 0x00000004 EXCCAUSE: 0x0000001c
EXCVADDR: 0x02001e00 LBEG : 0x4000c2e0 LEND : 0x4000c2f6 LCOUNT : 0xffffffff

ELF file SHA256: f63f54f303fe37aa3100ecd3e02b5cdecb2aee4a91ca01e8d89878162cfbd0dd

Backtrace: 0x4000c32d:0x3ffbcd60 |<-CORRUPTED

I have managed to extract a stack trace:

#0 0x4000c330 in ?? ()
#1 0x400d6a08 in btc_gap_bt_arg_deep_copy (msg=0x3ffbcda0, p_dest=0x3ffba410, p_src=0x400d6a08 <btc_gap_bt_arg_deep_copy+112>) at C:/Development/esp-idf/components/bt/host/bluedroid/btc/profile/std/gap/btc_gap_bt.c:759
#2 0x400e89e5 in btc_transfer_context (msg=0x3ffbcdd0, arg=0x3ffbcdd8, arg_len=24, copy_func=0x400d6998 <btc_gap_bt_arg_deep_copy>) at C:/Development/esp-idf/components/bt/common/btc/core/btc_task.c:201
#3 0x400d5e78 in esp_bt_gap_config_eir_data (eir_data=0x3ffbce20) at C:/Development/esp-idf/components/bt/host/bluedroid/api/esp_gap_bt_api.c:177
#4 0x400d536b in bt_app_gap_start_up () at ../main/main.c:92
#5 0x400d54f3 in app_main () at ../main/main.c:159
#6 0x400d1e85 in main_task (args=0x0) at C:/Development/esp-idf/components/esp32/cpu_start.c:554
#7 0x400908fc in vPortTaskWrapper (pxCode=0x400d1e20 <main_task>, pvParameters=0x0) at C:/Development/esp-idf/components/freertos/port.c:143

I populate an esp_bt_eir_data_t struct

esp_bt_eir_data_t eir_data;

eir_data.flag = ESP_BT_EIR_FLAG_GEN_DISC;
eir_data.manufacturer_len = sizeof(eir_buffer);
eir_data.p_manufacturer_data = eir_buffer;

I then call

esp_err_t ret = esp_bt_gap_config_eir_data(&eir_data);

I'm using a Wemos D1 with 4MB of RAM.

Could anyone offer any suggestions? I've looked around for some examples, but couldn't find anything.

ESP_Sprite
Posts: 9757
Joined: Thu Nov 26, 2015 4:08 am

Re: Call to esp_bt_gap_config_eir_data results in LoadProhibited kernal panic

Postby ESP_Sprite » Sat May 09, 2020 8:23 am

If anything, please zero-initialize structs like this: if it's not giving you issues now, it may very well so do so after an esp-idf update. Either implicitly clearing

Code: Select all

 esp_bt_eir_data_t eir_data={0};
or explicitly clearing after declaration

Code: Select all

memset(&eir_data, 0, sizeof(eir_data));
will work.

tomasmcguinness
Posts: 6
Joined: Thu Jul 18, 2019 9:20 pm

Re: Call to esp_bt_gap_config_eir_data results in LoadProhibited kernal panic

Postby tomasmcguinness » Sun May 10, 2020 7:24 pm

Yes, that certainly stopped the crash! Thank you.

Unfortunately, I now get this error:

BT_APPL: bta_dm_config_eir, malloc failed.

I will investigate further!

Thanks again for your help!

mamaheshwari
Posts: 10
Joined: Fri Oct 23, 2020 4:53 am

Re: Call to esp_bt_gap_config_eir_data results in LoadProhibited kernal panic

Postby mamaheshwari » Fri Dec 04, 2020 8:27 am

How did yo solve it. I am getting the same error

BT_APPL: bta_dm_config_eir, malloc failed.

Who is online

Users browsing this forum: VinayDand and 434 guests