Bluetooth problems when overclocking #1297

Closed
opened 2023-03-02 16:02:02 -06:00 by MichaelBell · 4 comments
MichaelBell commented 2023-03-02 16:02:02 -06:00 (Migrated from github.com)

When overclocking to 250MHz, I can only connect to bluetooth audio the very first time after powering on the Pico W.

After a reset (pulling RUN low), I can't reconnect. At lower clock speeds this works fine.

Changing cyw43_bus_pio_spi.c as follows:

-    sm_config_set_clkdiv_int_frac(&config, CLOCK_DIV, CLOCK_DIV_MINOR);
+    const int clock_mhz = clock_get_hz(clk_sys) / MHZ;
+    const int clock_div = (clock_mhz < 170) ? 2 : (1 + clock_mhz / 85);
+    sm_config_set_clkdiv_int_frac(&config, clock_div, 0);

fixes it, but given this problem must be related just to some kind of reset, and I don't recall having issues with a 250MHz overclock doing WiFi with a Pico W, this fix seems extreme.

When overclocking to 250MHz, I can only connect to bluetooth audio the very first time after powering on the Pico W. After a reset (pulling RUN low), I can't reconnect. At lower clock speeds this works fine. Changing cyw43_bus_pio_spi.c as follows: ``` - sm_config_set_clkdiv_int_frac(&config, CLOCK_DIV, CLOCK_DIV_MINOR); + const int clock_mhz = clock_get_hz(clk_sys) / MHZ; + const int clock_div = (clock_mhz < 170) ? 2 : (1 + clock_mhz / 85); + sm_config_set_clkdiv_int_frac(&config, clock_div, 0); ``` fixes it, but given this problem must be related just to some kind of reset, and I don't recall having issues with a 250MHz overclock doing WiFi with a Pico W, this fix seems extreme.
peterharperuk commented 2023-03-03 04:14:08 -06:00 (Migrated from github.com)

can only connect to bluetooth audio

Which direction? Source or sink or both? i.e. Is the Pico playing audio or is it connecting to a speaker to play audio? The latter I assume?

> can only connect to bluetooth audio Which direction? Source or sink or both? i.e. Is the Pico playing audio or is it connecting to a speaker to play audio? The latter I assume?
MichaelBell commented 2023-03-03 04:26:07 -06:00 (Migrated from github.com)

Sink - Pico playing audio from my iPhone. I'm running https://github.com/Gadgetoid/galactic-bluetooth-audio but with an overclock set in main()

Sink - Pico playing audio from my iPhone. I'm running https://github.com/Gadgetoid/galactic-bluetooth-audio but with an overclock set in `main()`
peterharperuk commented 2024-08-09 06:31:07 -05:00 (Migrated from github.com)

I was going to mark this as fixed by https://github.com/raspberrypi/pico-sdk/pull/1521
But overclocking to 250 seems to work fine for me without having to adjust the pio divisor. It's somewhat curious that the a2dp_sink_demo now needs to be overclocked to work properly but that's another issue.
I don't now why pulling run low would affect things. I tried this and it reconnected fine.
I'll mark this as fixed as your original issue (having to hack the code to set the divisor) has now been fixed and I can't seem to repro the problem with a2dp_sink_demo. Please reopen if you disagree.

I was going to mark this as fixed by https://github.com/raspberrypi/pico-sdk/pull/1521 But overclocking to 250 seems to work fine for me without having to adjust the pio divisor. It's somewhat curious that the a2dp_sink_demo now needs to be overclocked to work properly but that's another issue. I don't now why pulling run low would affect things. I tried this and it reconnected fine. I'll mark this as fixed as your original issue (having to hack the code to set the divisor) has now been fixed and I can't seem to repro the problem with a2dp_sink_demo. Please reopen if you disagree.
MichaelBell commented 2024-08-09 06:52:47 -05:00 (Migrated from github.com)

As this is in the realms of overclocking maybe it was related to the exact hardware I was running on.
Anyway, now there is the dynamic divider option for the CYW43 PIO that could easily be worked around if necessary so I agree with closing this issue.

As this is in the realms of overclocking maybe it was related to the exact hardware I was running on. Anyway, now there is the dynamic divider option for the CYW43 PIO that could easily be worked around if necessary so I agree with closing this issue.
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-raspberrypi/pico-sdk#1297
No description provided.