-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sleep_ms(900)
stuck forever when compiled with Debug Build Type
#2319
Comments
You don't mention what version of the SDK you are using? Can you try the LATEST master branch 2.1.1 that we released last week as it includes some timer fixes. |
Ok, sorry, I see you had the version in the log. |
I used a Pico 2 W (rp2350). I now also run it with a Pico W (rp2040) and it does not happen, also with |
I can't immediately reproduce your issue. I'm testing Pico 2 W on Windows and choosing "Pico Debug (Cortex Debug)". Is that what you're using? The is flashing and I see console output. It sounds like there are too many interrupts going off constantly. I would guess cyw43. I've no idea why it would only affect debug. You could try defining PICO_BTSTACK_CYW43_MAX_HCI_PROCESS_LOOP_COUNT=10 to limit the work done in hci_transport_cyw43_process in case that's constantly busy. |
Defining I'm working on macOS, but hope that should not make a difference. It's not about launching with a debugger but building the Debug Version like or setting So for me the following reproduces it: git clone /~https://github.com/bittailor/bt-pico-freeze-issue
cd bt-pico-freeze-issue
cmake -DPython3_EXECUTABLE=${HOME}/.pico-sdk/python/3.12.1/python.exe -DCMAKE_BUILD_TYPE=Debug -G Ninja -B ./build .
${HOME}/.pico-sdk/ninja/v1.12.1/ninja -C build
${HOME}/.pico-sdk/picotool/2.1.1/picotool/picotool load ./build/bt-pico-freeze-issue.elf -fx
sleep 2
screen /dev/tty.usbmodem21401 115200 As then, the output of screen is
and stuck at the last line of sleep 900 |
I have the issue that a
sleep_ms(900)
never returns when code is compiled withDebug
Build Type and uses BLE. I could reduce my code to a bt-pico-freeze-issue sample, with which I can reproduce the problem.When I run the sample with
Release
Build Type, all works perfect, BLE is advertising and the LED is blinking.When I run the sample with
Debug
Build Type, most of the time, the firstsleep_ms(900)
in the loop is stuck forever no LED blinking and also USB serial output stops, but BLE advertisement work. I can see them with a BLE scanner like nRF Connect.Very interesting is that when I then connect via BLE the
sleep_ms(900)
returns (even after being stuck for 5 minutes) and then the loop and with this the LED blinking works perfect. The same also happens when I disconnect and reconnect the USB serial port. So for me, it looks like some kind of external event fixes the stucksleep_ms()
.Serial output (USB) of
Debug
Build Type stuck at thesleep_ms(900)
:Serial output (USB) of
Debug
when I do a BLE connection after ~8 minutes :serial output (USB) of
Release
Build Type:When I debug it and break while the
sleep_ms()
is stuck, it's always at thetimer_time_reached
method (before the IRQ).When looking at the variable values, the method would actually return
true
so the sleep_until loop would end, but somehow it never gets over that line as if all CPU is used by IRQ handlers?The text was updated successfully, but these errors were encountered: