Closed egnor closed 1 month ago
I have learned: rp2040load is just a little wrapper that runs picotool load
and picotool reboot
, so no wonder it behaves similarly. So the real story here is that picotool load
/ picotool reboot
rapid fire causes firmware to wedge and the board to just sit there and USB to hang.
This COULD be worked around at the platformio integration level with a sleep or something, but... since it seems like nobody else is suffering from this??... maybe better try to address it at the root???...
Reproduced this with the Pico SDK alone. Will complain against them, closing out here! Sorry for the bother!
My system
pip install
gives me)maxgerhardt/platform-raspberrypi.git
)The issue
I originally opened the issue at https://github.com/earlephilhower/arduino-pico/issues/2153 but I think it now belongs here, if not even further down (e.g. in
rp2040load
). You can chase that link for all kinds of gory details, but to make a long story short, this sequence:pio run -t upload
pio run -t upload
... claims success, but leads to a hanging USB port, a zombie USB filesystem, and a board that's stuck somewhere. Sometimes after a minute or two the board will recover, sometimes not. Attempting to reload firmware again fails, as the serial port can't be found and the USB filesystem can't be used.Analysis
This loading method seems to work reliably:
stty 1200 < /dev/$PORT && sleep 5 && cp .pio/build/$PROJECT/firmware.uf2 /media/$USER/RPI-RP2
These wedge in the same way as
pio run -t upload
does:stty 1200 < /dev/$PORT && sleep 2 && picotool load -v .pio/build/$PROJECT/firmware.elf && picotool reboot
stty 1200 < /dev/$PORT && sleep 2 && ~/.platformio/packages/tool-rp2040tools/rp2040load -v -D .pio/build/trivial_test/firmware.elf
In the
picotool
one, adding asleep 2
betweenload
andreboot
seems to make it reliable?stty 1200 < /dev/$PORT && sleep 2 && picotool load -v .pio/build/$PROJECT/firmware.elf && sleep 2 && picotool reboot
wut
This is probably a bug in... the bootloader ?? the linux USB stack that somehow gets tweaked by the bootloader ??
picotool
and/orrp2040load
?? maybe even the earlephilhower core ?? which is all perhaps tweaked by the timing of the way this platformio integration does things ???