You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Notes on different boards and platforms (RP2040 / RP2350)
The majority of examples are applicable to both RP2040 and RP2350 based boards,
however certain examples that use chip-specific functionality will only build on that platform.
Similarly, Wi-Fi and Bluetooth examples will only build on a board that includes Wi-Fi and Bluetooth support.
Platform and board information are passed to the CMake build via the PICO_PLATFORM and PICO_BOARD variables.
By default, the Pico SDK targets builds for RP2040 (PICO_PLATFORM=rp2040). To build for RP2350 instead, pass
-DPICO_PLATFORM=rp2350 to CMake (or -DPICO_PLATFORM=rp2350-riscv for RISC-V). Alternatively, in many cases, you can rely
on the board configuration to set the platform for you. For example, passing -DPICO_BOARD=pico2 will automatically select PICO_PLATFORM=rp2350.
Obliterate the contents of flash. An example of a NO_FLASH binary (UF2 loaded directly into SRAM and runs in-place there). A useful utility to drag and drop onto your Pico if the need arises.
i2c slave example where the slave implements a 256 byte memory. This version inefficiently writes each byte in a separate call to demonstrate read and write burst mode.
Blinks the on-board LED (which is connected via the WiFi chip) with a slower system clock to show how to reconfigure communication with the WiFi chip at run time under those circumstances
Blinks the on-board LED (which is connected via the WiFi chip) with a faster system clock to show how to reconfigure communication with the WiFi chip at build time under those circumstances
Demonstrates how to implement a MQTT client application
FreeRTOS examples
These are examples of integrating Wi-Fi networking under FreeRTOS, and require you to set the FREERTOS_KERNEL_PATH
to point to the FreeRTOS Kernel. See https://github.com/FreeRTOS/FreeRTOS-Kernel
Runs the lwip-contrib/apps/ping test app under FreeRTOS in NO_SYS=0 (i.e. full FreeRTOS integration) mode. The test app uses the lwIP socket API in this case.
Demonstrates how to make a https request in NO_SYS=0 (i.e. full FreeRTOS integration)
Pico Bluetooth
These Bluetooth examples are only available for boards that support Bluetooth.
They are examples from the Blue Kitchen Bluetooth stack, see here for a full description.
By default, the Bluetooth examples are only built in one "mode" only (background, poll, or freertos), with the
default being background. This can be changed by passing -DBTSTACK_EXAMPLE_TYPE=poll etc. to CMake, or all
examples can be built (which may be slow) by passing -DBTSTACK_EXAMPLE_TYPE=all
Freertos versions can only be built if FREERTOS_KERNEL_PATH is defined.
The Bluetooth examples that use audio require code in pico-extras. Pass -DPICO_EXTRAS_PATH=${HOME}/pico-extras on the cmake command line or define PICO_EXTRAS_PATH=${HOME}/pico-extras in your environment and re-run cmake to include them in the build.
An LED blink with the pico_bootsel_via_double_reset library linked. This enters the USB bootloader when it detects the system being reset twice in quick succession, which is useful for boards with a reset button but no BOOTSEL button.
Use some other UART features like RX interrupts, hardware control flow, and data formats other than 8n1.
Universal
These are examples of how to build universal binaries which run on RP2040, and RP2350 Arm & RISC-V.
These require you to set PICO_ARM_TOOLCHAIN_PATH and PICO_RISCV_TOOLCHAIN_PATH to appropriate paths, to ensure you have compilers for both architectures.
Same as the nuke example, but universal. On RP2350 runs as a packaged SRAM binary, so is written to flash and copied to SRAM by the bootloader
USB Device
TinyUSB Examples
Most of the USB device examples come directly from the TinyUSB device examples directory here.
Those that are supported on RP2040 devices are automatically included as part of the pico-examples
build as targets named tinyusb_dev_<example_name>, e.g. https://github.com/hathach/tinyusb/tree/master/examples/device/hid_composite
is built as tinyusb_dev_hid_composite.
At the time of writing, these examples are available:
tinyusb_dev_audio_4_channel_mic
tinyusb_dev_audio_test
tinyusb_dev_board_test
tinyusb_dev_cdc_dual_ports
tinyusb_dev_cdc_msc
tinyusb_dev_dfu
tinyusb_dev_dfu_runtime
tinyusb_dev_dynamic_configuration
tinyusb_dev_hid_composite
tinyusb_dev_hid_generic_inout
tinyusb_dev_hid_multiple_interface
tinyusb_dev_midi_test
tinyusb_dev_msc_dual_lun
tinyusb_dev_net_lwip_webserver
tinyusb_dev_uac2_headset
tinyusb_dev_usbtmc
tinyusb_dev_video_capture
tinyusb_dev_webusb_serial
Whilst these examples ably demonstrate how to use TinyUSB in device mode, their CMakeLists.txt is set up in a way
tailored to how TinyUSB builds their examples within their source tree.
For a better example of how to configure CMakeLists.txt for using TinyUSB in device mode with the Raspberry Pi SDK
see below:
A copy of the TinyUSB device example with the same name, but with a CMakeLists.txt which demonstrates how to add a dependency on the TinyUSB device libraries with the Raspberry Pi Pico SDK
A USB CDC device example with two serial ports, one of which is used for stdio. The example exposes two serial ports over USB to the host. The first port is used for stdio, and the second port is used for a simple echo loopback. You can connect to the second port and send some characters, and they will be echoed back on the first port while you will receive a "OK\r\n" message on the second port indicating that the data was received.
USB Host
All the USB host examples come directly from the TinyUSB host examples directory here.
Those that are supported on RP2040 devices are automatically included as part of the pico-examples
build as targets named tinyusb_host_<example_name>, e.g. https://github.com/hathach/tinyusb/tree/master/examples/host/cdc_msc_hid
is built as tinyusb_host_cdc_msc_hid.
At the time of writing, there is only one host example available:
tinyusb_host_cdc_msc_hid
USB Dual Mode
USB Dual Mode uses PIO as a USB host controller and the RP2040 USB device controller as a device controller. All the USB dual examples come directly from the TinyUSB dual examples directory here.
Those that are supported on RP2040 devices are automatically included as part of the pico-examples
build as targets named tinyusb_dual_<example_name>, e.g. https://github.com/hathach/tinyusb/tree/master/examples/dual/host_hid_to_device_cdc
is built as tinyusb_dual_host_hid_to_device_cdc.
At the time of writing, there is only one dual example available: