maxgerhardt / platform-raspberrypi

Raspberry Pi: development platform for PlatformIO
Apache License 2.0
94 stars 46 forks source link

upload with default "picotool" method (actually "rp2040load") hangs without delay between "load" and "reboot" #65

Closed egnor closed 1 month ago

egnor commented 1 month ago

My system

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:

Analysis

This loading method seems to work reliably:

These wedge in the same way as pio run -t upload does:

In the picotool one, adding a sleep 2 between load and reboot seems to make it reliable?

wut

This is probably a bug in... the bootloader ?? the linux USB stack that somehow gets tweaked by the bootloader ?? picotool and/or rp2040load ?? maybe even the earlephilhower core ?? which is all perhaps tweaked by the timing of the way this platformio integration does things ???

egnor commented 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???...

egnor commented 1 month ago

Reproduced this with the Pico SDK alone. Will complain against them, closing out here! Sorry for the bother!