esp-idf icon indicating copy to clipboard operation
esp-idf copied to clipboard

OpenOCD profiling kills BLE (IDFGH-12722)

Open mickeyl opened this issue 9 months ago • 1 comments

Answers checklist.

  • [X] I have read the documentation ESP-IDF Programming Guide and the issue is not addressed there.
  • [X] I have updated my IDF branch (master or release) to the latest version and checked that the issue is present there.
  • [X] I have searched the issue tracker for a similar issue and not found a similar issue.

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

mickeyl avatar Apr 28 '24 16:04 mickeyl

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

esp-zhp avatar May 06 '24 02:05 esp-zhp

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 avatar May 07 '24 16:05 mickeyl

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.

mickeyl avatar May 07 '24 16:05 mickeyl

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

esp-zhp avatar May 08 '24 03:05 esp-zhp

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?

esp-zhp avatar May 08 '24 03:05 esp-zhp

What is the connection timeout you've set? image

esp-zhp avatar May 08 '24 03:05 esp-zhp

@zhp0406 I'm using ESP-IDF cc649ea869b8c24d19ba2d94c4d3f1146cb2947b + some patches on top of it, so basically the 5.2 release.

The OpenOCD is the one from Espressif official.

My connection timeout is set to 2000 ms.

mickeyl avatar May 26 '24 13:05 mickeyl