-
Notifications
You must be signed in to change notification settings - Fork 114
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
Unable to reset pico #88
Comments
By adding some logging to the source for the 1.1.2 release, I can determine that picotool can find two interfaces with altsettings: one with class/subclass of 2/2, and one with class/subclass of 10/0. Neither of these matches the defined class/subclass for reset. |
Having the same issue. When using PlatformIO (which uses the tool too), it works without problems. Checking the log (macOS) shows the following: Using picotool shows: but: Device at bus 1, address 4 appears to be a RP2040 device with a USB serial connection, so consider Now using the proposed command line shows: |
You need to ensure that
I guess that indicates that |
What I mean is PlatformIO (with Arduino) uses picotool (or I'm wrong?) to reset the Pico into BOOTSEL for uploading the uf2. So uploading via VSCode with PlatformIO does everything automatically. But when building my app with pico-sdk (No platformIO nor Arduino), I first have to reconnect Pico while pressing BOOTSEL. I would like to prevent this. |
Your log message indicates that PlatformIO is rebooting the Pico by changing the baud rate of the USB-serial device, which isn't something that picotool does itself.
Have you got stdio_usb enabled in your CMakeLists.txt ? See Chapter 4 in https://datasheets.raspberrypi.com/pico/getting-started-with-pico.pdf |
Ok understood. I thought the message "use -f to force the reboot" would tell me it does that. |
Copied from the README.md for this project:
i.e. if your Pico is already in BOOTSEL mode then the |
Yes, but you already mentioned the point I was talking about:
If PlatformIO is able to reboot the Pico, even if it is not in BOOTSEL mode nor has these interfaces enabled, I would expect Picotool to be able to handle this too. |
As already mentioned, it appears that PlatformIO (which I've not used myself) is using the |
@dmo9 Have you tried using |
No difference with sudo. Per the picotool documentation, it states the flag should work with "compatible" code, but there is no definition of what compatible code is. My code does call Interestingly, when flashing with picoprobe, which works fine, I get the following message: After a really light dive into picotool's source code, I noticed that picotool's error message probably from the following function on line 1584 of main.cpp: Could this be the root cause of the issue? |
If you want to do a slightly deeper dive, you should probably take a look at raspberrypi/pico-sdk#197 and #23 |
Ok, I figured out the problem: incompatible code. My code was exiting before picotool could send it commands. I suggest that the definition of compatible code is added to this repo's documentation. main.c:
CMakeLists.txt:
|
I had to change it to (probably because I'm using C, not C++):
With these changes, I was indeed able to get the And I guess that this is only needed if stdio is not used. So, any project using printf() probably automatically includes the usb stuff and therefore won't need any changes. But when stdlib is not use, then this also has to be added to CMakeLists.txt, probably:
I would ask that you add some instructions somewhere that explain which changes to make to the CMakeLists.txt and the source code in order to make this work with any Pico project, so that this resolution won't stay quite hidden in this long thread of the issues tracker. Huh, after some more testing, it seems that if the |
Good call on the import. I don't remember what libraries I had linked but I agree that it should be included in the documentation. I agree that main cannot return; that's why my code was within an infinite loop. |
You can set We can add a definition of compatible code to the readme - the definition being simply code that
|
Good to know. I wish these things were mentioned in the "Getting started" docs on the Raspi website, because I think they're essential for using the SDK. But those pages don't even have a feedback link.
Thank you. Please consider making this easier for newbies like me and mention that the lib to include in the MakeLists is then call "pico_stdio_usb", and that one needs to activate either that or the stdio lib so that this works, e.g. by showing examples like @dmo9 did here, along with my notes. |
You don't need I'll make that clear in the readme |
A bit of clarification to the newer people for why I was including pico_stdio_usb and stdio_usb_init() stdio_usb_init() is a wrapper function that initializes all standard IO(uart & USB) but since my application only uses usb, that’s all I initialized. |
This is because if your |
Added to the readme |
Hello , whenever you get that error message of picotool , next time try to do this: In your c file , import the stidio_usb.h library and write stidio_init_all() in the main function In the CMakeLists.txt : add this following line : pico__enable_stdio_usb(project name 1) By doing this , you would be able to flash any uf2 file into the pico without any issues, And by the way , I made a pico sdk project that can let you reset your pico into storage mode Good luck |
When I run
picotool.exe reboot -f -u
, I get the following error:ERROR: Unable to locate reset interface on the device
, despite the fact that running the info command indicatesDevice at bus 1, address 30 appears to be a RP2040 device with a USB serial connection, not in BOOTSEL mode. You can force reboot into BOOTSEL mode via 'picotool reboot -f -u' first.
. Running a load command does work, however, if I manually enter BOOTSEL via the button.I am using picotool 1.1.2 and libusb 1.0.26 on Windows 11.
I have tried using both the Win32 driver and the libusb-win32 driver from Zadig.
The text was updated successfully, but these errors were encountered: