RP2040 · MicroPython · C/C++ SDK

Raspberry Pi Pico

Your complete guide to connecting, debugging, and troubleshooting the Raspberry Pi Pico and Pico W — from first power-on to running your first WiFi scan.

✓ USB & BOOTSEL explained ✓ SWD debugging via picoprobe ✓ Pico W WiFi scan demo

Board Simulator

RASPBERRY PI PICO

Connect USB to start

Connection Methods

Getting the Pico Online

#1 Most Common Problem: Charge-Only Micro USB Cable

The vast majority of "Pico not detected" reports are caused by using a charge-only Micro USB cable. These cables are physically identical to data cables but have the data wires (D+ / D−) omitted — they supply 5 V power but cannot transfer any data. Your PC will never see the Pico, and no RPI-RP2 drive or COM port will appear.

👉 Before anything else: swap your cable with one you know carries data (e.g. the cable used to sync your phone or a known-good USB cable from a keyboard).

USB Connection & BOOTSEL Mode

The Pico connects via a Micro-USB cable. It has two distinct USB modes depending on how you plug it in:

💻

Normal Mode (program running)

Plug in USB normally. The Pico runs whatever firmware is on flash. Shows as a USB serial device (CDC).

📂

BOOTSEL Mode (flash new firmware)

Hold the BOOTSEL button, then plug in USB. Pico appears as a USB Mass Storage drive called RPI-RP2. Drag & drop a .uf2 file to flash.

Step-by-Step: First Flash

1

Download the firmware

Get micropython.uf2 from micropython.org or a .uf2 from the C SDK build.

2

Enter BOOTSEL mode

Hold the white BOOTSEL button on the Pico, plug in USB, then release the button.

3

Drag & Drop the .uf2 file

Copy the file onto the RPI-RP2 drive. The Pico will reboot automatically.

Done! LED blinks = firmware running

The onboard LED (GP25) blinks if the MicroPython default script runs.

Debugging Methods

From printf to breakpoints

🖨️

UART / USB printf

The simplest approach. Route stdio to USB or UART and use printf() in C or print() in MicroPython. Best for quick logs.

Low overhead
🔍

GDB + Picoprobe SWD

Full hardware breakpoints, step-through, watchpoints and register inspection via OpenOCD + GDB or the VS Code Cortex-Debug extension. Ideal for C/C++ SDK.

Full control
📊

Thonny Debugger

MicroPython users can use Thonny's built-in step-over / step-into debugger. Set breakpoints by clicking the gutter, inspect variables in the Variables panel.

Beginner-friendly
C SDK — Enable stdio_usb for printf debugging
// In CMakeLists.txt, add:
pico_enable_stdio_usb(your_target 1)
pico_enable_stdio_uart(your_target 0)

// In your main.c:
#include "pico/stdlib.h"
#include <stdio.h>

int main() {
    stdio_init_all();
    // Wait for USB serial to enumerate
    sleep_ms(2000);
    printf("Pico booted! Core 0 running.\n");

    while (true) {
        printf("Tick: %llu ms\n", to_ms_since_boot(get_absolute_time()));
        sleep_ms(1000);
    }
}

Interactive Troubleshooter

Answer a few questions to pinpoint your issue.

What symptom are you experiencing?

Common Questions & Issues

Quick Reference

📡

Pico W — WiFi Network Scanner

The Raspberry Pi Pico W adds an Infineon CYW43439 WiFi/Bluetooth chip. Below is a MicroPython example that scans for nearby networks and prints them sorted by signal strength.

wifi_scan.py — MicroPython (Pico W)
import network
import time

# Initialise the WLAN interface in Station mode
wlan = network.WLAN(network.STA_IF)
wlan.active(True)

print("Scanning for WiFi networks...")
time.sleep(1)  # Give radio time to warm up

# scan() returns a list of tuples:
# (ssid, bssid, channel, RSSI, security, hidden)
networks = wlan.scan()

# Sort by signal strength (RSSI, index 3), strongest first
networks.sort(key=lambda n: n[3], reverse=True)

SECURITY = {0:"Open", 1:"WEP", 2:"WPA", 3:"WPA2", 4:"WPA/WPA2"}

print(f"\n{'SSID':<28} {'Ch':>2}  {'RSSI':>5}  Security")
print("-" * 52)

for net in networks:
    ssid    = net[0].decode() if net[0] else "<hidden>"
    channel = net[2]
    rssi    = net[3]
    sec     = SECURITY.get(net[4], "Unknown")
    print(f"{ssid:<28} {channel:>2}  {rssi:>5}  {sec}")

print(f"\n{len(networks)} network(s) found.")

Simulated Output

Press "Run Scan" to simulate a scan

> waiting for scan...

💡 On real hardware: paste wifi_scan.py into Thonny and press Run.

Activate Station mode

Sets the WiFi chip into client (STA) mode so it can discover access points.

Call wlan.scan()

Returns raw scan results as a list of tuples including SSID, channel, RSSI and security type.

Sort & Display

Networks are sorted by RSSI (strongest first) and printed in a formatted table.