espressif / esp-idf

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

OpenOCD profiling kills BLE (IDFGH-12722) #13706

Open mickeyl opened 2 weeks ago

mickeyl commented 2 weeks ago

Answers checklist.

IDF version.

v5.2

Espressif SoC revision.

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

Operating System used.

Linux

How did you build your project?

Command line with idf.py

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

None

Development Kit.

Custom Board

Power Supply used.

USB

What is the expected behavior?

I tried to profile using OpenOCD and hoped the BLE connection would keep intact.

What is the actual behavior?

The BLE connection drops down as soon as the profiling starts.

Steps to reproduce.

  1. call openocd.
  2. start your program
  3. telnet into openocd
  4. call profile 10 gmon.out

Debug Logs.

No response

More Information.

No response

zhp0406 commented 1 week ago

What is the error code when BLE disconnects, can you give me the complete log?

mickeyl commented 1 week ago

There is no error in the log, that's the thing (not even w/ verbose logs). The BLE layer just hangs and the other side gets a connection timeout:

May 07 16:32:12.450  L2CAP Receive    0x0053  F4:12:FA:DF:21:FA  Channel ID: 0x004C  Length: 0x0006 (06) [ 04 00 1F 80 00 00 ]  
May 07 16:32:12.450  L2CAP Receive    0x0053  F4:12:FA:DF:21:FA  LE Flow Control Credit  
May 07 16:32:12.599  HCI Event        0x0053  F4:12:FA:DF:21:FA  Number Of Completed Packets - Handle: 0x0053 - Packets: 0x0001    
May 07 16:32:15.451  HCI Event        0x0053  F4:12:FA:DF:21:FA  Disconnection Complete - Connection Timeout  
mickeyl commented 1 week ago

The nature of the OpenOCD profiler is that it stops and restarts the target very rapidly to get its samples. Perhaps that messes up the internal BLE timers? Interestingly, this does not happen if I do the same on WiFi.

Oh, and more… the device does not become unresponsive. All the other functions are still working. Just the BLE layer hangs.

zhp0406 commented 1 week ago

Which specific version are you using? Based on your version, I'll provide you with a controller library for testing.

zhp0406 commented 1 week ago

Is the OpenOCD you're using on the ESP32-S3 from Espressif official or third-party? Could you provide some information about the OpenOCD you're using?

zhp0406 commented 1 week ago

What is the connection timeout you've set? image