Raspberry Pi Pico Survival Guide

Here are tips on how to get started developing for Raspberry Pi Pico boards on Windows using the Pico C SDK.

Windows setup

Just use the Windows installer which is available on GitHub. At the end it will ask for a path to put the examples code. As you proceed it will open a terminal window to setup the examples. Make sure you wait for it to complete. Then from the Windows start menu search for Pico and launch Pico - Visual Studio Code. If you are using the Pico W board edit .vscode\settings.json to specify the board model as explained in those FAQ.

.vscode/settings.json:
  "cmake.configureSettings": {
    …
    "PICO_BOARD": "pico_w"
    …
  }

Click on the CMake icon in the side panel and make sure Configure specifies Pico ARM GCC as shown below.
1717969210974.png


I'm not quite sure now at which stage the CMake configuration occurs but you can trigger it from the context menu of any CMakeList.txt file in the project explorer. When you modify a CMake file the configuration will run automatically.

1717969685681.png


Build your code

Back to the CMake panel you can build individual examples using the build icon next to its name.

1717969982942.png


The build output you find in the corresponding build subfolder. For our Pico W blink example that will be \pico-examples\build\pico_w\wifi\blink. Note that the basic Pico blink example does not work on the Pico W board as the LED is attached to the Wi-Fi controller.

Flashing your board

Being a bit familiar with Arduino or even ESP-IDF where the flashing is usually handled by the tool chain over serial COM port after the build, it seem the Pico does not work like that. Instead when you plug your Pico to your PC USB port in bootloader mode it is mounted as a removable drive under Windows. You then need to copy that .uf2 file from your build output folder to the Pico drive. As soon as the .uf2 file is copied the board will reboot and execute your program.
1718013146127.png

To switch back to boot loader mode hold down the board BOOTSEL button as you plug it in to your PC. This process is notably mentioned here.
I'm not sure if there is another convenient way to do that from Visual Studio Code.

Logs over USB serial emulation

Now that we can execute our program we need to be able to monitor it. That's typically done over USB serial COM port. Here again on Arduino or ESP-IDF that's just working out-of-the-box but not on Raspberry Pi Pico. I'm assuming the default configuration on Pico is to output to an actual UART serial port you can typically hook to using a Raspberry Pi Debug Probe. If you just want to use the USB port for that you'll have to add the following to your CMakeLists.txt:

CMakeLists.txt inserts for picow_blink project:
pico_enable_stdio_usb(picow_blink 1)
pico_enable_stdio_uart(picow_blink 0)

With this enabled you should see the COM port being created in Windows Device Manager and your printf output should end up in Visual Studio Code serial monitor. Much of that is also explained there.
1718020066649.png


Create your own project

At this stage you may want to create your own project instead of just modifying the examples.
 
Last edited:
Back
Top