Never unplug your Raspberry Pi Pico again
HTML-код
- Опубликовано: 11 сен 2024
- NOTE: If you get "No accessible RP2040 devices in BOOTSEL mode were found." make sure that your program initializes the USB code via a call to "stdio_init_all()".
In this tutorial we explore how we can update the binary on our Pico without unplugging and re-plugging it all the time. No special equipment required!
Example CMakeLists.txt: gist.github.com/eldelto/0740e8f5259ab528702cef74fa96622e
Custom Makefile for even more automation: github.com/eldelto/project-ikaros/blob/main/Makefile#L60
Your videos are criminally underrated. Such good quality tutorials should have thousands (or even hundreds of thousands) of views.
Please continue doing what you're doing!
Edit: Subscribed, liked and "belled"
Thanks for the lovely praise :)
Thanks for these tutorials. I found them incredibly helpful. Hopefully you have more down the pipeline!
Glad you liked them!
I'll hope to get around doing videos more regularly in the new year. But there will be more for sure :)
Thank you so much.
Thanks for this info ! Great tutorial
Glad you liked it :)
If only this actually worked :(
EDIT: it randomly started working a while after i applied the changes you suggested? wtf lol
Does it now reliably work for you? Apparently some people run into problems and I would like to figure out the root cause.
It seems to work reliably? Although if I don't have an infinite loop in my main function (i.e. if main exits), then it does not work.@@eldelto
Yeah I think that is unavoidable. As long as some program is running, the usb code should be able to do its job and respond to the picotool commands though.
Thanks for pointing that out!
You'' need to run 'brew install pkgconfig' - after your prior tutorial, as it's required for this one (otherwise you'll get some libusb not found error)
Excellent catch, thanks for sharing!
Thank you! I ran into that exact problem.
I got the same error, "No accessible RP2040 devices in BOOTSEL mode were found" and since other people with the problem didn't answer, I'll mention that I did add "pico_enable_stdio_usb(blink 1)" in ../CMakeLists.txt, reran "cmake ..", changed ../blink.c to make sure it re-compiled, ran make, got a bigger executable (about 17k instead of 16k; note: I also see pico_stdio_usb in the .map file), manually copied it to the pico first (in BOOTSEL mode using Finder), it was flashing in a new pattern so I knew it had the new executable running. Then I tried "picotool load -f blink.uf2" (with the path of my compiled picotool of course) but got that error.
Then if I put it into BOOTSEL mode (holding down the button while unplugging / re-plugging the USB cable) I can run any of the picotool commands (picotool info, picotool load -f, picotool reboot). After reboot I can no longer run any of them without getting that error.
Hello, that still sounds like the binary doesn't include the usb lib stack, even though from your description everything sounds correct. Did you already try cleaning out the build/ directory and running the cmake step again?
If that doesn't work out would you like to share your project? I would love to figure out what the culprit is.
Also maybe checkout www.eldelto.net/articles/raspberry-pi-pico-no-hands-flashing which is the writeup of this whole procedure. It also links to an example CMake file and to another project where I use this hack.
Hope any of can be of help.
@@deltocodemy replies keep disappearing. Not sure if they’re in an approval queue or something. I’ll try describing the location without a link: I put my source, and cmake related files on GitHub. My username is the same as on RUclips, and the project name should be obvious, pico-blink
@@drivers99 I checked it out today and it looks like you're missing a call to stdio_init_all() at the beginning of your main function. I only own the Pico board with the WIfi chip and there it was already present in the blink example. Didn't realize it wasn't present in the example of the regular board.
I hope that solves it now! :)
@@deltocode woohoo! That's what it was! Thank you. That was above and beyond.
I guess usb stack on pico is very heavy and not always suitable for some projects.
Absolutely! But I think it is a neat trick when not pushing the code size limits :)
Performed same steps but got "No accessible RP2040 devices in BOOTSEL mode were found.". What might be wrong?
At the very end when trying to flash via picotool? Maybe try manually flashing a program with pico_enable_stdio_usb in the Makefile.
When running the "../../pico/picotool/build/picotool load -f blink.uf2" command i get this:
No accessible RP2040 devices in BOOTSEL mode were found.
It is like the -f doesn't work. I checked the picotool github page but i got nothing. Even when i do it while in bootsel mode it doesnt even upload the uf2 file.
Hello! Did you manually flash your board with a program that has stdio via USB enabled (adding pico_enable_stdio_usb(blink 1) in your CMakeLists.txt) before using the picotool command?
@@deltocode Yes i did. This is the CMakeLists.txt file in the my-project directory:
cmake_minimum_required(VERSION 3.13)
include(pico_sdk_import.cmake)
project(test_project C CXX ASM)
set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)
pico_sdk_init()
add_executable(blink
blink.c
)
target_include_directories(blink PRIVATE
${CMAKE_CURRENT_LIST_DIR}
)
# Uncomment if you want to flash your board via picotool.
pico_enable_stdio_usb(blink 1)
pico_add_extra_outputs(blink)
target_link_libraries(blink
pico_stdlib
# Uncomment when using Pico W
# pico_cyw43_arch_none
)
target_link_libraries(pico_stdlib)
And i am using the non-wifi chip