# Raspberry Pi Pico A development board for the [[rp2040]], comes in two variants: - Pi Pico - Pi Pico W, a Wifi enabled [[rp2040]] board, basically a [[Raspberry Pi Pico]] with a [[CYW43439]] Wifi chip. ![[Raspberry Pi Pico W-1664643144377.jpeg]] ## Specification **Form Factor:** 21 mm × 51 mm **CPU:** - Dual-core Arm [[ARM Cortex-M]]0+ @ 133MHz **Memory**: - 264KB on-chip SRAM - 2MB on-board QSPI flash **Peripherals:** - 26 [[GPIO]] pins, including 3 [[ADC]] inputs - 2 × [[UART]] - 2 × [[SPI]] controllers - 2 × [[I2C]] controllers - 16 × [[PWM]] channels - 1 × [[USB]] 1.1 controller and PHY, with host and device support - 8 × [[rp2040 Programmable IO]] state machines **Connectivity**: 2.4GHz IEEE 802.11b/g/n wireless LAN, on-board antenna **Input Power**: 1.8–5.5V DC **Operating Temperature**: -20°C to +70°C ### Power supply > Pico uses an on-board buck-boost SMPS which is able to generate the required 3.3V (to power RP2040 and external circuitry) from a wide range of input voltages (~1.8 to 5.5V). This allows significant flexibility in powering the unit from various sources such as a single Lithium-Ion cell, or 3 AA cells in series. Battery chargers can also be very easily integrated with the Pico powerchain. ## Peripherals ### GPIOs Four RP2040 IO are used for internal functions - driving an LED, on- board Switched Mode Power Supply (SMPS) power control and sensing the system voltages. ### Programmable IO The [[rp2040]] also has something called "[[rp2040 Programmable IO]] IO" (see [What is PIO? - Raspberry Pi](https://www.raspberrypi.com/news/what-is-pio/)) which is really cool, as you can implement state machines in hardware for additional protocols, or even just adding more of a certain type of interface. See also: [What is Programmable I/O on Raspberry Pi Pico? — HackSpace magazine](https://hackspace.raspberrypi.com/articles/what-is-programmable-i-o-on-raspberry-pi-pico) ## Raspberry Pi Pico Pinout ![[Raspberry Pi Pico-1664649933692.jpeg]] ## Datasheets Pico W Board Datasheet: - [https://datasheets.raspberrypi.com/picow/pico-w-datasheet.pdf](https://datasheets.raspberrypi.com/picow/pico-w-datasheet.pdf) Pico Board Datasheet: - [https://datasheets.raspberrypi.com/pico/pico-datasheet.pdf](https://datasheets.raspberrypi.com/pico/pico-datasheet.pdf) RP2040 chip datasheet: - [https://datasheets.raspberrypi.com/rp2040/rp2040-datasheet.pdf](https://datasheets.raspberrypi.com/rp2040/rp2040-datasheet.pdf) ## Links The launch article: - [Raspberry Pi Pico W: your $6 IoT platform - Raspberry Pi](https://www.raspberrypi.com/news/raspberry-pi-pico-w-your-6-iot-platform/) Raspberry PI 3-pin debug connector specification: - [https://datasheets.raspberrypi.com/debug/debug-connector-specification.pdf](https://datasheets.raspberrypi.com/debug/debug-connector-specification.pdf) Getting started guide (C/C++): - [https://datasheets.raspberrypi.com/pico/getting-started-with-pico.pdf](https://datasheets.raspberrypi.com/pico/getting-started-with-pico.pdf) Raspberry Pi Pico SDK (C/C++) - [GitHub - raspberrypi/pico-sdk](https://github.com/raspberrypi/pico-sdk) - [https://datasheets.raspberrypi.com/pico/raspberry-pi-pico-c-sdk.pdf](https://datasheets.raspberrypi.com/pico/raspberry-pi-pico-c-sdk.pdf) - [Raspberry Pi Pico SDK: Raspberry Pi Pico SDK](https://raspberrypi.github.io/pico-sdk-doxygen/) - Examples: [GitHub - raspberrypi/pico-examples](https://github.com/raspberrypi/pico-examples) Arduino SDK port: - [GitHub - earlephilhower/arduino-pico: Raspberry Pi Pico Arduino core, for all RP2040 boards](https://github.com/earlephilhower/arduino-pico) Raspberry Pi's main page about the product. - [Raspberry Pi Documentation - Raspberry Pi Pico and Pico W](https://www.raspberrypi.com/documentation/microcontrollers/raspberry-pi-pico.html) Connecting to the internet with Pi Pico W (with C/C++ or [[MicroPython]]): - [https://datasheets.raspberrypi.com/picow/connecting-to-the-internet-with-pico-w.pdf](https://datasheets.raspberrypi.com/picow/connecting-to-the-internet-with-pico-w.pdf) This is the Wifi chip used: - [CYW43439 - Infineon Technologies](https://www.infineon.com/cms/en/product/wireless-connectivity/airoc-wi-fi-plus-bluetooth-combos/cyw43439/) Hardware design with RP2040: - [https://datasheets.raspberrypi.com/rp2040/hardware-design-with-rp2040.pdf](https://datasheets.raspberrypi.com/rp2040/hardware-design-with-rp2040.pdf) ## Rust on the [[Raspberry Pi Pico]] - [GitHub - embassy-rs/cyw43: Pure-Rust driver for the CYW43439 (WiFi chip used in the Raspberry Pi Pico W)](https://github.com/embassy-rs/cyw43) - with support for [[embassy-net Rust networking]], this actually has DHCP and TCP support! So actually worth looking into. This is built on the [[Embedded Rust]] embassy project. HEre is a link to the RP HAL: - [GitHub - rp-rs/rp-hal: A Rust Embedded-HAL for the rp series microcontrollers](https://github.com/rp-rs/rp-hal) This is the board support for the Pico: - [rp-hal/boards/rp-pico at main · rp-rs/rp-hal · GitHub](https://github.com/rp-rs/rp-hal/tree/main/boards/rp-pico) This is really cool, as it for example already has examples for [[rtic]] , the 'real time interrupt driven concurrency framework'. ## Wifi Host Driver This is based on the [[Infineon]] host driver. Pretty cool that that is opensource! - [GitHub - Infineon/wifi-host-driver: Embedded Wi-Fi Host Driver that provides a set of APIs to interact with Cypress WLAN chips](https://github.com/Infineon/wifi-host-driver) > The WHD is an independent, embedded Wi-Fi Host Driver that provides a set of APIs to interact with Infineon WLAN chips. The WHD is an independent firmware product that is easily portable to any embedded software environment, including popular IOT frameworks like Mbed OS, Amazon FreeRTOS, etc. Hence, the WHD includes hooks for RTOS and TCP/IP network abstraction layers. - [Wi-Fi Host Driver (WHD): Main Page](https://infineon.github.io/wifi-host-driver/html/index.html) ## Instructions for debugging a Pico with another Pico From [rp2040-project-template/debug_probes.md at main · rp-rs/rp2040-project-template · GitHub](https://github.com/rp-rs/rp2040-project-template/blob/main/debug_probes.md) ### DapperMime ![[2022-10-01-1664643344629.jpeg]] You can use a second Pico as your debugger. - Download this file: [https://github.com/majbthrd/DapperMime/releases/download/20210225/raspberry_pi_pico-DapperMime.uf2](https://github.com/majbthrd/DapperMime/releases/download/20210225/raspberry_pi_pico-DapperMime.uf2) - Boot the Pico in bootloader mode by holding the bootset button while plugging it in - Open the drive RPI-RP2 when prompted - Copy raspberry_pi_pico-DapperMime.uf2 from Downloads into RPI-RP2 - Connect the debug pins of your CMSIS-DAP Pico to the target one - Connect GP2 on the Probe to SWCLK on the Target - Connect GP3 on the Probe to SWDIO on the Target - Connect a ground line from the CMSIS-DAP Probe to the Target too --- ### Debug one core with the other You can actually go a step wilder and use one pico core to debug the other core: [GitHub - majbthrd/pico-debug: virtual debug pod for RP2040 "Raspberry Pi Pico" with no added hardware](https://github.com/majbthrd/pico-debug) ``` RP2040 has two ARM Cortex-M0+ cores, and the second core normally remains dormant. pico-debug runs on one core in a RP2040 and provides a USB CMSIS-DAP interface to debug the other core. No hardware is added; it is as if there were a virtual debug pod built-in. Boot the RP2040 with the BOOTSEL button pressed, copy over pico-debug.uf2, and it immediately reboots as a CMSIS-DAP adapter. pico-debug loads as a RAM only .uf2 image, meaning that it is never written to flash and doesn't replace existing user code. ``` ### Picoprobe There is also a probe firmware straight from [[Raspberry Pi]]: - [GitHub - raspberrypi/picoprobe](https://github.com/raspberrypi/picoprobe) but it is not compatible with [[CMSIS-DAP]]: - [Take advantage of CMSIS-DAP ecosystem · Issue #2 · raspberrypi/picoprobe · GitHub](https://github.com/raspberrypi/picoprobe/issues/2) But there is a pull request here: - [Add a CMSIS compatible implementation for picoprobe by P33M · Pull Request #31 · raspberrypi/picoprobe · GitHub](https://github.com/raspberrypi/picoprobe/pull/31) Here's a twitter thread about the speed of picoprobe: - [https://twitter.com/arturo182/status/1440720804145078280?lang=en](https://twitter.com/arturo182/status/1440720804145078280?lang=en) and a full blog post about [[CMSIS-DAP]] probe performance: - [CMSIS-DAP debug probe performance | 9names’ projects](https://9names.github.io/embedded/rust/debug/2022/04/07/cmsisdap-probe-performance.html) Apparently the [[ST-Link v3]] is the fastest, but it only works with [[STM32]] microcontrollers. ### rust-dap rust-dap provides the fastest flashing speed I could find. In fact, I can flash the 90kB firmwares in about 2 seconds, which is just fine for iterative development using the debugger. [rust-dap/boards/rpi_pico at main · ciniml/rust-dap · GitHub](https://github.com/ciniml/rust-dap/tree/main/boards/rpi_pico) runs on rp2040, so we could this a try. But, I would need a rp2040 probe to flash the probe.