Open rac146 opened 1 month ago
@rac146 Hi rac146, from your description, it seems that BLE connection will fail to establish if device does not enter light sleep mode. However, I didn't manage to reproduce the issue using the ESP32-C6-DevKitM-1 chip and external 32kHz xtal. There's are some aspects you can look into:
BLE connection will establish, it just doesn't hold the connection correctly. After a brief amount of work out of light sleep mode, the BLE connection will drop with a 520 disconnect error.
Looking a little further into it, I switched CONFIG_RTC_CLK_CAL_CYCLES from 5000 to 8000 but that didn't help either.
@rac146 Hi rac146,
From your response, It's possible that the frequency drift of your crystal is too large to maintain a connection given that same issue will not happen with main XTAL as clock source. Please measure the your crystal's accuracy and check this point.
Answers checklist.
IDF version.
v5.3.1
Espressif SoC revision.
ESP32C6
Operating System used.
macOS
How did you build your project?
VS Code IDE
If you are using Windows, please specify command line type.
None
Development Kit.
Seeed XIAO ESP32C6
Power Supply used.
USB
What is the expected behavior?
When using BLE power save with an external crystal, allow successful connection while running CPU tasks.
What is the actual behavior?
When using BLE power save with an external crystal, BLE will not connect successfully while running CPU tasks.
Steps to reproduce.
The easiest way to reproduce this issue is to run the BLE Power Save Example
Just set a while loop at the bottom of the example in main to simulate work:
BLE will consistently fail to connect.
OR
If you build with
CONFIG_PM_TRACE=y
AND setlight_sleep_enable = false
in the PM config; then try to connect to BLE it will consistently fail to connect.More Information.
I originally noticed this when trying to write to an OLED display - my BLE would disconnect immediately when the display was written to. Then I realized a similar behavior with CONFIG_PM_TRACE=y. It seems certain CPU operations will cause the BLE to disconnect with a 520 error when the power save configuration settings are used.
External crystal is running correctly.
If I disable switch from
CONFIG_BT_LE_LP_CLK_SRC_DEFAULT=y
back toCONFIG_BT_LE_LP_CLK_SRC_MAIN_XTAL=y
it will connect successfully.Does anyone know why this is happening when using the external 32 Khz crystal?