• Stars
    star
    2,030
  • Rank 22,803 (Top 0.5 %)
  • Language
    C
  • License
    GNU Lesser Genera...
  • Created almost 4 years ago
  • Updated about 1 month ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Raspberry Pi Pico Arduino core, for all RP2040 and RP2350 boards

Arduino-Pico

Release Gitter

Raspberry Pi Pico Arduino core, for all RP2040 boards

This is a port of the RP2040 (Raspberry Pi Pico processor) to the Arduino ecosystem. It uses the bare Raspberry Pi Pico SDK and a custom GCC 10.3/Newlib 4.0 toolchain.

Documentation

See https://arduino-pico.readthedocs.io/en/latest/ along with the examples for more detailed usage information.

Contributing

Read the Contributing Guide for more information on submitting pull requests and porting libraries or sketches to this core.

Supported Boards

  • Raspberry Pi Pico
  • Raspberry Pi Pico W
  • 0xCB Helios
  • Adafruit Feather RP2040
  • Adafruit Feather RP2040 SCORPIO
  • Adafruit ItsyBitsy RP2040
  • Adafruit KB2040
  • Adafruit Macropad RP2040
  • Adafruit QTPy RP2040
  • Adafruit STEMMA Friend RP2040
  • Adafruit Trinkey RP2040 QT
  • Arduino Nano RP2040 Connect
  • ArtronShop RP2 Nano
  • BridgeTek IDM2040-7A
  • Cytron Maker Pi RP2040
  • Cytron Maker Nano RP2040
  • DatanoiseTV PicoADK+
  • DeRuiLab FlyBoard2040 Core
  • DFRobot Beetle RP2040
  • ElectronicCats Hunter Cat NFC
  • ExtremeElectronics RC2040
  • Invector Labs Challenger RP2040 WiFi
  • Invector Labs Challenger RP2040 WiFi/BLE
  • Invector Labs Challenger NB RP2040 WiFi
  • Invector Labs Challenger RP2040 LTE
  • Invector Labs Challenger RP2040 LoRa
  • Invector Labs Challenger RP2040 SubGHz
  • Invector Labs Challenger RP2040 SD/RTC
  • Invector Labs Challenger RP2040 UWB
  • Invector Labs RPICO32
  • Melopero Cookie RP2040
  • Melopero Shake RP2040
  • Neko Systems BL2040 Mini
  • nullbits Bit-C PRO
  • Pimoroni PGA2040
  • Seeed Indicator RP2040
  • Seeed XIAO RP2040
  • Solder Party RP2040 Stamp
  • SparkFun ProMicro RP2040
  • SparkFun Thing Plus RP2040
  • uPesy RP2040 DevKit
  • VCC-GND YD-RP2040
  • Viyalab Mizu RP2040
  • Waveshare RP2040 Zero
  • Waveshare RP2040 One
  • Waveshare RP2040 Plus
  • Waveshare RP2040 LCD 0.96
  • Waveshare RP2040 LCD 1.28
  • WIZnet W5100S-EVB-Pico
  • WIZnet W5500-EVB-Pico
  • WIZnet WizFi360-EVB-Pico
  • Generic (configurable flash, I/O pins)

Installing via Arduino Boards Manager

Windows-specific Notes

Please do not use the Windows Store version of the actual Arduino application because it has issues detecting attached Pico boards. Use the "Windows ZIP" or plain "Windows" executable (EXE) download direct from https://arduino.cc. and allow it to install any device drivers it suggests. Otherwise the Pico board may not be detected. Also, if trying out the 2.0 beta Arduino please install the release 1.8 version beforehand to ensure needed device drivers are present. (See #20 for more details.)

Linux-specific Notes

Installing Arduino using flatpak (often used by "App Stores" in various Linux distributions) will mean it has restricted access to the host. This might cause uploads to fail with error messages such as the following:

Scanning for RP2040 devices
...
No drive to deploy.

If you encounter this, you will need to either install Arduino in a different manner, or override the flatpak sandboxing feature using the following command, then restarting Arduino.

flatpak override --user --filesystem=host:ro cc.arduino.IDE2

Installation

Open up the Arduino IDE and go to File->Preferences.

In the dialog that pops up, enter the following URL in the "Additional Boards Manager URLs" field:

https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json

image

Hit OK to close the dialog.

Go to Tools->Boards->Board Manager in the IDE

Type "pico" in the search box and select "Add":

image

Installing via GIT

Windows Users: Before installing via git on Windows, please read and follow the directions in this link. If Win32 long paths are not enabled, and git not configured to use them then there may be errors when attempting to clone the submodules.

To install via GIT (for latest and greatest versions):

mkdir -p ~/Arduino/hardware/pico
git clone https://github.com/earlephilhower/arduino-pico.git ~/Arduino/hardware/pico/rp2040
cd ~/Arduino/hardware/pico/rp2040
git submodule update --init
cd pico-sdk
git submodule update --init
cd ../tools
python3 ./get.py

Installing both Arduino and CMake

Tom's Hardware presented a very nice writeup on installing arduino-pico on both Windows and Linux, available at https://www.tomshardware.com/how-to/program-raspberry-pi-pico-with-arduino-ide

If you follow Les' step-by-step you will also have a fully functional CMake-based environment to build Pico apps on if you outgrow the Arduino ecosystem.

Uploading Sketches

To upload your first sketch, you will need to hold the BOOTSEL button down while plugging in the Pico to your computer. Then hit the upload button and the sketch should be transferred and start to run.

After the first upload, this should not be necessary as the arduino-pico core has auto-reset support. Select the appropriate serial port shown in the Arduino Tools->Port->Serial Port menu once (this setting will stick and does not need to be touched for multiple uploads). This selection allows the auto-reset tool to identify the proper device to reset. Them hit the upload button and your sketch should upload and run.

In some cases the Pico will encounter a hard hang and its USB port will not respond to the auto-reset request. Should this happen, just follow the initial procedure of holding the BOOTSEL button down while plugging in the Pico to enter the ROM bootloader.

Uploading Filesystem Images

The onboard flash filesystem for the Pico, LittleFS, lets you upload a filesystem image from the sketch directory for your sketch to use. Download the needed plugin from

To install, follow the directions in

For detailed usage information, please check the ESP8266 repo documentation (ignore SPIFFS related notes) available at

Uploading Sketches with Picoprobe

If you have built a Raspberry Pi Picoprobe, you can use OpenOCD to handle your sketch uploads and for debugging with GDB.

Under Windows a local admin user should be able to access the Picoprobe port automatically, but under Linux udev must be told about the device and to allow normal users access.

To set up user-level access to Picoprobes on Ubuntu (and other OSes which use udev):

echo 'SUBSYSTEMS=="usb", ATTRS{idVendor}=="2e8a", ATTRS{idProduct}=="0004", GROUP="users", MODE="0666"' | sudo tee -a /etc/udev/rules.d/98-PicoProbe.rules
sudo udevadm control --reload

The first line creates a file with the USB vendor and ID of the Picoprobe and tells UDEV to give users full access to it. The second causes udev to load this new rule. Note that you will need to unplug and re-plug in your device the first time you create this file, to allow udev to make the device node properly.

Once Picoprobe permissions are set up properly, then select the board "Raspberry Pi Pico (Picoprobe)" in the Tools menu and upload as normal.

Uploading Sketches with pico-debug

pico-debug differs from Picoprobe in that pico-debug is a virtual debug pod that runs side-by-side on the same RP2040 that you run your code on; so, you only need one RP2040 board instead of two. pico-debug also differs from Picoprobe in that pico-debug is standards-based; it uses the CMSIS-DAP protocol, which means even software not specially written for the Raspberry Pi Pico can support it. pico-debug uses OpenOCD to handle your sketch uploads, and debugging can be accomplished with CMSIS-DAP capable debuggers including GDB.

Under Windows and macOS, any user should be able to access pico-debug automatically, but under Linux udev must be told about the device and to allow normal users access.

To set up user-level access to all CMSIS-DAP adapters on Ubuntu (and other OSes which use udev):

echo 'ATTRS{product}=="*CMSIS-DAP*", MODE="664", GROUP="plugdev"' | sudo tee -a /etc/udev/rules.d/98-CMSIS-DAP.rules
sudo udevadm control --reload

The first line creates a file that recognizes all CMSIS-DAP adapters and tells UDEV to give users full access to it. The second causes udev to load this new rule. Note that you will need to unplug and re-plug in your device the first time you create this file, to allow udev to make the device node properly.

Once CMSIS-DAP permissions are set up properly, then select the board "Raspberry Pi Pico (pico-debug)" in the Tools menu.

When first connecting the USB port to your PC, you must copy pico-debug-gimmecache.uf2 to the Pi Pico to load pico-debug into RAM; after this, upload as normal.

Debugging with Picoprobe/pico-debug, OpenOCD, and GDB

The installed tools include a version of OpenOCD (in the pqt-openocd directory) and GDB (in the pqt-gcc directory). These may be used to run GDB in an interactive window as documented in the Pico Getting Started manuals from the Raspberry Pi Foundation. For pico-debug, replace the raspberrypi-swd and picoprobe example OpenOCD arguments of "-f interface/raspberrypi-swd.cfg -f target/rp2040.cfg" or "-f interface/picoprobe.cfg -f target/rp2040.cfg" respectively in the Pico Getting Started manual with "-f board/pico-debug.cfg".

Features

  • Adafruit TinyUSB Arduino (USB mouse, keyboard, flash drive, generic HID, CDC Serial, MIDI, WebUSB, others)
  • Bluetooth on the PicoW (Classic and BLE) with Keyboard, Mouse, Joystick, and Virtual Serial
  • Generic Arduino USB Serial, Keyboard, Joystick, and Mouse emulation
  • WiFi (Pico W)
  • HTTP client and server (WebServer)
  • SSL/TLS/HTTPS
  • Over-the-Air (OTA) upgrades
  • Filesystems (LittleFS and SD/SDFS)
  • Multicore support (setup1() and loop1())
  • FreeRTOS SMP support
  • Overclocking and underclocking from the menus
  • digitalWrite/Read, shiftIn/Out, tone, analogWrite(PWM)/Read, temperature
  • Analog stereo audio in using DMA and the built-in ADC
  • Analog stereo audio out using PWM hardware
  • USB drive mode for data loggers (SingleFileDrive)
  • Peripherals: SPI master, Wire(I2C) master/slave, dual UART, emulated EEPROM, I2S audio input, I2S audio output, Servo
  • printf (i.e. debug) output over USB serial

The RP2040 PIO state machines (SMs) are used to generate jitter-free:

  • Servos
  • Tones
  • I2S Input
  • I2S Output
  • Software UARTs (Serial ports)

Tutorials from Across the Web

Here are some links to coverage and additional tutorials for using arduino-pico

Contributing

If you want to contribute or have bugfixes, drop me a note at [email protected] or open an issue/PR here.

Licensing and Credits

  • The Arduino IDE and ArduinoCore-API are developed and maintained by the Arduino team. The IDE is licensed under GPL.
  • The RP2040 GCC-based toolchain is licensed under under the GPL.
  • The Pico-SDK is by Raspberry Pi (Trading) Ltd and licensed under the BSD 3-Clause license.
  • Arduino-Pico core files are licensed under the LGPL.
  • LittleFS library written by ARM Limited and released under the BSD 3-clause license.
  • UF2CONV.PY is by Microsoft Corporation and licensed under the MIT license.
  • Networking and filesystem code taken from the ESP8266 Arduino Core and licensed under the LGPL.
  • DHCP server for AP host mode from the Micropython Project, distributed under the MIT License.
  • FreeRTOS is Copyright Amazon.com, Inc. or its affiliates, and distributed under the MIT license.
  • lwIP is (c) the Swedish Institute of Computer Science and licenced under the BSD license.
  • BearSSL library written by Thomas Pornin, is distributed under the MIT License.
  • UZLib is copyright (c) 2003 Joergen Ibsen and distributed under the zlib license.
  • LEAmDNS is copyright multiple authors and distributed under the MIT license.
  • http-parser is copyright Joyent, Inc. and other Node contributors.
  • WebServer code modified from the ESP32 WebServer and is copyright (c) 2015 Ivan Grokhotkov and others

-Earle F. Philhower, III
[email protected]

More Repositories

1

ESP8266Audio

Arduino library to play MOD, WAV, FLAC, MIDI, RTTTL, MP3, and AAC files on I2S DACs or with a software emulated delta-sigma DAC on the ESP8266 and ESP32
C
2,037
star
2

ESP8266SAM

Speech synthesis for ESP8266 using S.A.M. port
C
308
star
3

ezfio

Simple NVME/SAS/SATA SSD test framework for Linux and Windows
Python
166
star
4

mklittlefs

Utility for creating LittleFS images for upload on the ESP8266 and RP2040 Pico
C++
156
star
5

arduino-littlefs-upload

Build and uploads LittleFS filesystems for the Arduino-Pico RP2040, RP2350, ESP8266, and ESP32 cores under Arduino IDE 2.2.1 or higher
TypeScript
131
star
6

arduino-esp8266littlefs-plugin

Plugin to upload LittleFS filesystems to ESP8266
Java
125
star
7

bearssl-esp8266

Port of https://bearssl.org BearSSL to ESP8266
C
48
star
8

psychoclock

ESP8266 alarm clock with 8x32 LED display, NTP time, and MOD/WAV music alarms
Objective-C
43
star
9

pico-quick-toolchain

GCC Cross-compiler chain for Raspberry Pi Pico
Makefile
35
star
10

arduino-pico-littlefs-plugin

LittleFS Data Uploader for Arduino-Pico
Java
29
star
11

psychoplug

ESP8266 power outlet replacement firmware with standalone HTTP scheduler and MQTT integration
C++
27
star
12

aquaweb

Control Jandy Aqualink via a web interface
Python
20
star
13

ESP8266AudioMP3

Port of Helix MP3 code to ESP8266
C
12
star
14

libmad-8266

Port of libmad to ESP-8266 Arduino IDE - for historical purposes only, see ESP8266Audio for updated versions
C++
9
star
15

ESP8266FastROMFS

Higher-speed filesystem to replace SPIFFS in apps not needing all SPIFFs assurances.
C++
9
star
16

SPIFTL

Embedded, Static Wear-Leveling FTL Library for Microcontrollers
C++
8
star
17

ESP8266WavetableSynth

Obsolete, please use ESP8266Audio - TinySoundFont + MidiTones based MIDI player using SoundFont2 patch sets.
C
1
star
18

eggplotter

Based off of https://www.thingiverse.com/thing:3564057 Egg Plotter
C++
1
star