Open gherlein opened 1 week ago
Curious indeed...
I have to kill and restart the serial connection to get it to work again.
"kill and restart" from the Pico W side, from the Pico Probe side, or from the PC-side?
How are you powering the Pico W and Pico Probe? If they're both being powered from the same USB port, I wonder if the additional power draw from the WiFi chip is causing a brownout? (Perhaps https://github.com/raspberrypi/debugprobe/issues/148 is relevant here? )
Does this happen with the standard pico-examples? I certainly never reset my serial connection. Are you using Windows or Linux? What does the "reset" command do?
UPDATE: I don't see this from other test code, so this may be something weird in my setup or example code. If so, I really apologize. I'm capturing the state of things here just in case, but other test programs using the same libraries are NOT exhibiting this behavior. I hope I didn't waste your time.
I am on Linux, no Windows in my house. On the serial side, I use screen from a Linux terminal. When I say "reset" I mean "ctrl-a k y" to end the screen session, then restart screen at the Linux command line. NOT at the Pico.
The PicoProbe is on it's own USB port, separate from the Pico. I usually power the Pico from a USB power supply, not plugged into a computer.
My experience is that at least on Ubuntu if I connect the Pico and PicoProbe to the computer AND use the USB serial connection to the computer AND do a reset or flash the Pico over the probe THEN I have to restart screen (e.g. "ctrl-a k y" to end the screen session, then restart screen). That's no matter what I run.
IF I power the Pico from a USB power supply AND connect the PicoProbe to the computer AND use the UART serial connection to the computer AND do a reset or flash the Pico over the probe THEN serial just keeps on going, no restart of the screen session required.
EXCEPT for the test code I shared, which is also here: https://github.com/gherlein/picow-blink
AND, similar code, that uses the same library AND actually does useful WiFI stuff (sets up an AP) that is here: https://github.com/gherlein/pico-ap/tree/main works just fine.
Same exact configuration, computer, wiring, installation of the SDK, everything. I'll chase this a little later today and see if I can find something. I hate dangling unexplained things.
This may be something I don't grok about how the UART and the wifi chip interact. Here's the setup NOT using wifi:
I have a PicoProbe connected to SWD and to UART0 (GP0 and GP1). Anything I printf comes across just great, and the serial connection survives a chip flash or reset. For example, I can do this:
openocd -f interface/cmsis-dap.cfg -f target/rp2040.cfg -c "adapter speed 5000" -c "init ; reset halt ; rp2040.core1 arp_reset assert 0 ; rp2040.core0 arp_reset assert 0 ; exit"
it's magic - the board resets and I have serial maintained across the link.
UNLESS I also use anything in pico_cyw43_arch_lwip_threadsafe_background - even blinking the LED. What happens is that I have to kill and restart the serial connection to get it to work again.
I'm not deep enough into this all to understand, but it seems like something in that library is resetting the UART somehow?
Anyone able to explain this? The code is below
(Edited by lurch to put the code inside triple-backticks)