ESP32 Crashed when listening BLE advertising after long time

xzwang
Posts: 22
Joined: Wed Dec 14, 2016 4:54 am

ESP32 Crashed when listening BLE advertising after long time

Postby xzwang » Thu Mar 02, 2017 3:01 am

Hi,guys,
I got a crash when listening BLE advertising after long time. The crash INFO is followed:

BT: command_timed_out hci layer timeout waiting for response to a command. opcode: 0x200c[0m
***ERROR*** A stack overflow in task Tmr Svc has been detected.
abort() was called at PC 0x40086b24
Guru Meditation Error: Core 0 panic'ed (abort)

Backtrace: 0x40085c94:0x3ffd19a0 0x40084040:0x3ffd19c0 0x4008382f:0x3ffd19e0 0x4008579f:0x3ffd1a10 0x40085830:0x3ffd1a30 0x40085da3:0x3ffd1a60

I can't find opcode 0x200c in esp-idf. Does anyone can tell me why it crashed ?
Thanks.

Lucas.Hutchinson
Posts: 79
Joined: Tue Apr 26, 2016 5:10 am

Re: ESP32 Crashed when listening BLE advertising after long time

Postby Lucas.Hutchinson » Thu Mar 02, 2017 5:28 am

How long were you scanning for devices?

I would suggest that it found too many devices while scanning.
I would suggest scanning for shorter periods.

If the device required is not found in the first scan, stop scanning then start scanning again.
This will alow FreeRTOS/ the BLE tasks to free up the buffers used in the previous scan which should prevent the stack overflow that you are experiencing.

xzwang
Posts: 22
Joined: Wed Dec 14, 2016 4:54 am

Re: ESP32 Crashed when listening BLE advertising after long time

Postby xzwang » Thu Mar 02, 2017 5:52 am

Thanks for your reply.

I have scanning BLE advertising for several hours.
That's true there are many BLE device in test environment.

However, I didn't concern the BLE device name, but the information in BLE advertising, It means that no specific device was required. And I also restart scanning when ESP_GAP_SEARCH_INQ_CMPL_EVT happened. The key code in esp_gap_callback as followed:

Code: Select all

case ESP_GAP_BLE_SCAN_PARAM_SET_COMPLETE_EVT: {
        //the unit of the duration is second
    	gap_status = SCANNING;
        esp_ble_gap_start_scanning(duration);
        break;
    }
case ESP_GAP_BLE_SCAN_RESULT_EVT: {
        break;
    }

case ESP_GAP_SEARCH_INQ_CMPL_EVT:{
        //esp_ble_gap_stop_scanning();

        //continue scanning...
        vTaskDelay( 100 / portTICK_RATE_MS);
        esp_ble_gap_start_scanning( duration );
    break;
    }
Maybe the method of restarting scanning was error, any other suggestion?
Thanks.

FlyingPig
Posts: 1
Joined: Fri Mar 02, 2018 3:01 am

Re: ESP32 Crashed when listening BLE advertising after long time

Postby FlyingPig » Mon Jul 02, 2018 7:55 am

I have the same question. do you have solve it ?

chegewara
Posts: 1234
Joined: Wed Jun 14, 2017 9:00 pm

Re: ESP32 Crashed when listening BLE advertising after long time

Postby chegewara » Tue Jul 03, 2018 6:00 am

The question is what task is Tmr Svc? Its internal task, probably timer. Since you have stack overflow you will need to change stack size in menuconfig if its possible for this task, but first someone need to help us to find out which task it is.
***ERROR*** A stack overflow in task Tmr Svc has been detected

Gianluca.Loi
Posts: 11
Joined: Mon Jun 03, 2019 3:46 pm

Re: ESP32 Crashed when listening BLE advertising after long time

Postby Gianluca.Loi » Tue Sep 15, 2020 2:06 pm

Hello,

I'm having the same problem. I'm using v4.3 IDF version.
Did you solve the problem?

Regards,

Gianluca.

fennmart
Posts: 1
Joined: Tue Sep 15, 2020 3:52 pm

Re: ESP32 Crashed when listening BLE advertising after long time

Postby fennmart » Tue Sep 15, 2020 3:56 pm

Nice to see this post here and thanks for sharing this to us.

Gianluca.Loi
Posts: 11
Joined: Mon Jun 03, 2019 3:46 pm

Re: ESP32 Crashed when listening BLE advertising after long time

Postby Gianluca.Loi » Thu Sep 17, 2020 6:47 am

Hello everyone,

Has somebody any update about this issue?

Regards,

Gianluca.

chegewara
Posts: 1234
Joined: Wed Jun 14, 2017 9:00 pm

Re: ESP32 Crashed when listening BLE advertising after long time

Postby chegewara » Thu Sep 17, 2020 7:22 am

Did you try to increase timer task stack in menuconfig?

Gianluca.Loi
Posts: 11
Joined: Mon Jun 03, 2019 3:46 pm

Re: ESP32 Crashed when listening BLE advertising after long time

Postby Gianluca.Loi » Thu Sep 17, 2020 7:27 am

chegewara wrote:
Thu Sep 17, 2020 7:22 am
Did you try to increase timer task stack in menuconfig?
Hello chegewara,

No, I didn't try.
I will make a test and I will share the result.

Thank you,
Regards,

Gianluca

Who is online

Users browsing this forum: No registered users and 36 guests