RP2040-GEEK

From Waveshare Wiki
Jump to: navigation, search
RP2040-GEEK
RP2040-GEEK.jpg

SWD, UART, USB-A
{{{name2}}}

{{{name3}}}

{{{name4}}}

{{{name5}}}

{{{name6}}}

Overview

Introduction

RP2040-GEEK is a geeks development board designed by Waveshare, onboard USB-A interface, 1.14-inch LCD screen, TF card slot, and other peripherals. Provides different firmware for SWD port, UART port, and I2C port.

Feayures

  • RP2040 microcontroller chip designed by Raspberry Pi in the United Kingdom.
  • Dual-core ARM Cortex M0+ processor, with a high operating frequency of up to 133MHz and flexible clock.
  • Built-in 264KB of SRAM and 4MB of onboard Flash.
  • Onboard 1.14-inch 240×135 pixel 65K color IPS LCD display.
  • Onboard 3PIN SWD port for connecting the debugged target board.
    • Standard CMSIS-DAP interface can be used to debug most ARM-based microcontrollers.
    • Works with OpenOCD and other tools supporting CMSIS-DAP.
    • Adopts the Raspberry Pi 3PIN Debug Connector Specification.
  • Onboard 3PIN USB to UART bridge.
  • Onboard 4PIN I2C port for the testing target board.
  • Equipped with plastic case and cables.
  • Open-source firmware, more convenient to upgrade.

Dimensions

RP2-4- geek 09.jpg

Pico Getting Started

Firmware Download

  • MicroPython Firmware Download

MicroPython Firmware Download.gif

  • C_Blink Firmware Download

C Blink Download.gif

Introduction

Raspberry Pi Pico Basics

MicroPython Series

Install Thonny IDE

In order to facilitate the development of Pico/Pico2 boards using MicroPython on a computer, it is recommended to download the Thonny IDE

  • Download Thonny IDE and follow the steps to install, the installation packages are all Windows versions, please refer to Thonny's official website for other versions
  • After installation, the language and motherboard environment need to be configured for the first use. Since we are using Pico/Pico2, pay attention to selecting the Raspberry Pi option for the motherboard environment

Pico-R3-Tonny1.png

  • Configure MicroPython environment and choose Pico/Pico2 port
    • Connect Pico/Pico2 to your computer first, and in the lower right corner of Thonny left-click on the configuration environment option --> select Configture interpreter
    • In the pop-up window, select MicroPython (Raspberry Pi Pico), and choose the corresponding port

700px-Raspberry-Pi-Pico-Basic-Kit-M-2.png
700px-Raspberry-Pi-Pico-Basic-Kit-M-3.png

Flash Firmware

  • Click OK to return to the Thonny main interface, download the corresponding firmware library and burn it to the device, and then click the Stop button to display the current environment in the Shell window
  • Note: Flashing the Pico2 firmware provided by Micropython may cause the device to be unrecognized, please use the firmware below or in the package
  • How to download the firmware library for Pico/Pico2 in windows: After holding down the BOOT button and connecting to the computer, release the BOOT button, a removable disk will appear on the computer, copy the firmware library into it
  • How to download the firmware library for RP2040/RP2350 in windows: After connecting to the computer, press the BOOT key and the RESET key at the same time, release the RESET key first and then release the BOOT key, a removable disk will appear on the computer, copy the firmware library into it (you can also use the Pico/Pico2 method)

Raspberry-Pi-Pico2-Python.png

MicroPython Series

【MicroPython】 machine.Pin class function details
【MicroPython】machine.PWM class function details
【MicroPython】machine.ADC class function details
【MicroPython】machine.UART class function details
【MicroPython】machine.I2C class function details
【MicroPython】machine.SPI class function details
【MicroPython】rp2.StateMachine class function details

C/C++ Series

For C/C++, it is recommended to use Pico VS Code for development. This is a Microsoft Visual Studio Code extension designed to make it easier for you to create, develop, and debug projects for the Raspberry Pi Pico series development boards. No matter if you are a beginner or an experienced professional, this tool can assist you in developing Pico with confidence and ease. Here's how to install and use the extension.

  • Official website tutorial: https://www.raspberrypi.com/news/pico-vscode-extension/
  • This tutorial is suitable for Raspberry Pi Pico, Pico2 and the RP2040 and RP2350 series development boards developed by Waveshare
  • The development environment defaults to Windows. For other environments, please refer to the official tutorial for installation

Install VSCode

  1. First, click to download pico-vscode package, unzip and open the package, double-click to install VSCode
    Pico-vscode-1.JPG
    Note: If vscode is installed, check if the version is v1.87.0 or later
    Pico-vscode-2.JPG
    Pico-vscode-3.JPG

Install Extension

  1. Click Extensions and select Install from VSIX
    Pico-vscode-4.JPG
  2. Select the package with the vsix suffix and click Install
    Pico-vscode-5.JPG
  3. Then vscode will automatically install raspberry-pi-pico and its dependency extensions, you can click Refresh to check the installation progress
    Pico-vscode-6.JPG
  4. The text in the right lower corner shows that the installation is complete. Close VSCode
    Pico-vscode-7.JPG

Configure Extension

  1. Open directory C:\Users\username and copy the entire .pico-sdk to that directory
    Pico-vscode-8.JPG
  2. The Copy is completed
    Pico-vscode-9.JPG
  3. Open vscode and configure the paths for the Raspberry Pi Pico extensions
    Pico-vscode-10.JPG
    The configuration is as follows:
    Cmake Path:
    ${HOME}/.pico-sdk/cmake/v3.28.6/bin/cmake.exe
    
    Git Path:
    ${HOME}/.pico-sdk/git/cmd/git.exe    
    
    Ninja Path:
    ${HOME}/.pico-sdk/ninja/v1.12.1/ninja.exe
    
    Python3 Path:
    ${HOME}/.pico-sdk/python/3.12.1/python.exe             
    

New Project

  1. The configuration is complete, create a new project, enter the project name, select the path, and click Create to create the project
    To test the official example, you can click on the Example next to the project name to select
    Pico-vscode-11.JPG
  2. The project is created successfully
    Pico-vscode-12.JPG
  3. Select the SDK version
    Pico-vscode-13.JPG
  4. Select Yes for advanced configuration
    Pico-vscode-14.JPG
  5. Choose the cross-compilation chain, 13.2.Rel1 is applicable for ARM cores, RISCV.13.3 is applicable for RISCV cores. You can select either based on your requirements
    Pico-vscode-15.JPG
  6. Select default for CMake version (the path configured earlier)
    Pico-vscode-16.JPG
  7. Select default for Ninjaversion
    Pico-vscode-17.JPG
  8. Select the development board
    Pico-vscode-18.JPG
  9. Click Complie to compile
    Pico-vscode-19.JPG
  10. The uf2 format file is successfully compiled
    Pico-vscode-20.JPG

Import Project

  1. The Cmake file of the imported project cannot have Chinese (including comments), otherwise the import may fail
  2. To import your own project, you need to add a line of code to the Cmake file to switch between pico and pico2 normally, otherwise even if pico2 is selected, the compiled firmware will still be suitable for pico
    Pico-vscode-21.JPG set(PICO_BOARD pico CACHE STRING "Board type")

Update Extension

  1. The extension version in the offline package is 0.15.2, and you can also choose to update to the latest version after the installation is complete
    Pico-vscode-22.JPG

Arduino IDE Series

Install Arduino IDE

  1. First, go to Arduino official website to download the installation package of the Arduino IDE.
    600px-Arduino下载2.0版本.jpg
  2. Here, you can select Just Download.
    仅下载不捐赠.png
  3. Once the download is complete, click Install.
    IDE安装水印-1.gif
    Notice: During the installation process, it will prompt you to install the driver, just click Install
    600px

Arduino IDE Interface

  1. After the first installation, when you open the Arduino IDE, it will be in English. You can switch to other languages in File --> Preferences, or continue using the English interface.
    首选项-简体中文.jpg
  2. In the Language field, select the language you want to switch to, and click OK.
    600px-首选项-简体中文ok.jpg

Install Arduino-Pico Core in the Arduino IDE

  1. Open the Arduino IDE, click on the file in the top left corner, and select Preferences
    RoArm-M1 Tutorial04.jpg
  2. Add the following link to the attached board manager URL, and then click OK
    https://github.com/earlephilhower/arduino-pico/releases/download/4.0.2/package_rp2040_index.json

    RoArm-M1 Tutorial II05.jpg
    Note: If you already have an ESP32 board URL, you can use a comma to separate the URLs as follows:

    https://dl.espressif.com/dl/package_esp32_index.json,https://github.com/earlephilhower/arduino-pico/releases/download/4.0.2/package_rp2040_index.json
  3. Click Tools > Development Board > Board Manager > Search pico, as my computer has already been installed, it shows that it is installed
    Pico Get Start 05.png
    Pico Get Start 06.png

Upload Demo at the First Time

  1. Press and hold the BOOTSET button on the Pico board, connect the pico to the USB port of the computer via the Micro USB cable, and release the button after the computer recognizes a removable hard disk (RPI-RP2).
    Pico Get Start.gif
  2. Download the program and open D1-LED.ino under the arduino\PWM\D1-LED path
  3. Click Tools --> Port, remember the existing COM, do not click this COM (the COM displayed is different on different computers, remember the COM on your own computer)
    UGV1 doenload02EN.png
  4. Connect the driver board to the computer using a USB cable. Then, go to Tools > Port. For the first connection, select uf2 Board. After uploading, when you connect again, an additional COM port will appear
    UGV1 doenload03EN.png
  5. Click Tools > Development Board > Raspberry Pi Pico > Raspberry Pi Pico or Raspberry Pi Pico 2
    Pico Get Start02.png
  6. After setting it up, click the right arrow to upload the program
    Pico Get Start03.png
  • If issues arise during this period, and if you need to reinstall or update the Arduino IDE version, it is necessary to uninstall the Arduino IDE completely. After uninstalling the software, you need to manually delete all contents within the C:\Users\[name]\AppData\Local\Arduino15 folder (you need to show hidden files to see this folder). Then, proceed with a fresh installation.

Open Source Demos

MircoPython video demo (github)
MicroPython firmware/Blink demos (C)
Raspberry Pi official C/C++ demo (github)
Raspberry Pi official micropython demo (github)
Arduino official C/C++ demo (github)


Sample Demo

C/C++ Demo

01-LCD

  1. It takes 2.5s to display a picture on the LCD.
  2. The example for LCD displaying the GUI.

02-picoprobe

  • This demo is based on the open-sourced picoprobe demo.
  • Run the picoprobe demo on the RP2040-GEEK, and it will analog a USB TO SWD and USB TO UART device.
  1. Use UART as the tool for USB to UART for communication with the device.
  2. Use the SWD interface as the debug tool for openocd to debug most of the arm chips.
  • For more information on how to use picoprobe, please refer to the following "picoprobe Tutorial".

03-FATFS

  1. This demo repeatedly attempts to mount an SD card and read its root directory, with the option to get its runtime information using a USB serial port.

RP2040-GEEK-DEMO.jpg

  • Note that the SD card file format is FAT32.

Micropython Demo

01-LCD

How to Use

1. Upload all py and BMP files to RP2040-GEEK via thonny.
RP2040-Thonny.jpg

Demo Effect

  • LCD displays the GUI, and then bmp picture after a few seconds.

02-SD

How to Use

  • Upload all the py files to the RP2040-GEEK via thonny, and reset.

RP2040-Thonny02.jpg

Demo Effect

  • After RP2040-GEEK resets, it will automatically mount the SD card to the sd file according to the "boot.py" demo.

RP2040-Thonny03.jpg

  • Double-click the SD file folder and you can see the file stored on the SD card.

RP2040-Thonny04.jpg

Picoprobe User Guide

Install OpenOCD

Linux (and Raspberry Pi)

Download the Dependency Library

sudo apt install automake autoconf build-essential texinfo libtool libftdi-dev libusb-1.0-0-dev

Get and Compile

git clone https://github.com/raspberrypi/openocd.git --branch rp2040 --depth=1 --no-single-branch
cd openocd
./bootstrap
./configure
make -j4
sudo make install

Windows

1. As OpenOCD self-compilation is complicated in the windows environment, it is recommended to use the already compiled version.
2. Unzip and store in a relatively short directory, e.g. directly in the C drive.

Add Environment Variables

1. Click the menu, and search "environment variables".

Raspberry Pi Debug Probe05.jpg

2. Click "Edit the system environment variables":

Raspberry Pi Debug Probe06.jpg

3. Double-click the "Path" variable, and then enter the edit interface.

Raspberry Pi Debug Probe07.jpg

4. Add a new path.

Raspberry Pi Debug Probe08.jpg

  • Create a new variable address.
  • Enter the OpenOCD storage address.
  • Click OK to save.
5. Click "OK" and save the change.

Raspberry Pi Debug Probe09.jpg

6. Reboot the computer.

Install GDB

Linux (and Raspberry Pi)

1. Install gdb-multiarch.
sudo apt install gdb-multiarch

Windows

1. If you have installed the related pico-sdk environment, you can skip this step as the GDB is included in Arm GNU Toolchain.
2. If you have not installed the related pico-sdk environment, it is recommended to install it with the official pico demo.

Program the Demo with Raspberry Pi Debug Probe

  • With Pico Debug Probe, you can load the binaries via the SWD port and OpenOCD.
  • You do not need to unplug and hold the BOOTSEL button every time you push a new binary to Pico.
1. Take RP2040 usage as an example, the commands for programming the demo:
sudo openocd -f interface/cmsis-dap.cfg -f target/rp2040.cfg -c "adapter speed 5000" -c "p​​rogram {your elf file name}.elf verify reset exit"
2. If there is a blink.elf file in your current file folder.
sudo openocd -f interface/cmsis-dap.cfg -f target/rp2040.cfg -c "adapter speed 5000" -c "p​​rogram blink.elf verify reset exit"

Debug the Demo with Raspberry Pi Debug Probe

Open OpenOCD Server

  • You can let openocd be used in server mode and connect to GDB, thus providing you with breakpoints and "correct" debugging.
1. Here is also an example of debugging the rp2040 by entering the following command:
sudo openocd -f interface/cmsis-dap.cfg -f target/rp2040.cfg -c "adapter speed 5000"
  • Take using PowerShell in windows as an example:

Raspberry Pi Debug Probe010.jpg

2. *If you start listening on the local 3333 port at this point, the OpenOCD server has been successfully turned on.

Use GDB Command Line

  • This demo is set up based on pico-sdk, and pico-example was compiled.
1. Open PowerShell and enter the corresponding "build" file folder, take the blink demo as an example.

Raspberry Pi Debug Probe011.jpg

2. Open GBD and enter the following commands:
  • If it is windows, you can input the following commands:
arm-none-eabi-gdb blink.elf
  • If it is Linux, you can input the following commands:
gdb blink.elf

Raspberry Pi Debug Probe012.jpg

3. Input the following commands in order:
target remote localhost:3333
load
monitor reset init
continue

Raspberry Pi Debug Probe013.jpg

  • You can see Pico executes blink, and LED blinks.

Use VSCode to Debug (Advanced)

  • Please make sure that the #Open OpenOCD Server and the #Use GDB Command Line are running properly.
  • Please make sure the Pico compilation environment is set up normally.
  • Please make sure your VSCode can install the following plug-in.
1. Cortex-Debug ()
2. Cmake-tools
3. C/C++

1. First, open the OpenOCD server:
Raspberry Pi Debug Probe010.jpg
2. Use VSC to open the pico-example file folder and open the blink demo.
3. Use F1 to input the following commands:

open 'launch.json'

4. Put the following content in after opening. Raspberry Pi Debug Probe014.jpg

  • If it is Windows, please input:
{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Pico Debug",
            "type":"cortex-debug",
            "cwd": "${workspaceRoot}",
            "executable": "${command:cmake.launchTargetPath}",
            "request": "launch",
            "servertype": "external",
            // This may need to be arm-none-eabi-gdb depending on your system
            "gdbPath" : "gdb",
            // Connect to an already running OpenOCD instance
            "gdbTarget": "localhost:3333",
            "svdFile": "${env:PICO_SDK_PATH}/src/rp2040/hardware_regs/rp2040.svd",
            "runToMain": true,
            // Work around for stopping at main on restart
            "postRestartCommands": [
                "break main",
                "continue"
            ]
        }
    ]
}
  • If it is a Linux system, please input:
{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Pico Debug",
            "type":"cortex-debug",
            "cwd": "${workspaceRoot}",
            "executable": "${command:cmake.launchTargetPath}",
            "request": "launch",
            "servertype": "external",
            // This may need to be arm-none-eabi-gdb depending on your system
            "gdbPath" : "arm-none-eabi-gdb",
            // Connect to an already running OpenOCD instance
            "gdbTarget": "localhost:3333",
            "svdFile": "${env:PICO_SDK_PATH}/src/rp2040/hardware_regs/rp2040.svd",
            "runToMain": true,
            // Work around for stopping at main on restart
            "postRestartCommands": [
                "break main",
                "continue"
            ]
        }
    ]
}
  • The difference between them is the gdb calls are different.

5. Enter the run and debug interface shortcut key Ctrl + Shift + D.
Raspberry Pico Debug Probe07.jpg

  • ①Select Pico Debug as the debugger.
  • ②Select CMake as the debug mode.
  • ③Start to debug the key, the shortcut key F5.
  • ④Choose the debug object as blink.

6. Click debug key to enter the debug mode, the shortcut key is F5.
Raspberry Pi Debug probe90.jpg
7. The Debug Tools show:
Raspberry Pi Debug Probe91.jpg

  • ①Restart the device.
  • ②Continue to run the demo.
  • ③Execute.
  • ④Enter the function to run.
  • ⑤Jumping out of function runs.
  • ⑥Stop debugging.

8. Continue to run the demo, press F5 and you can see Pico runs the blink demo.

Resource

Document

Demo

Official Resources

Raspberry Pi Official Datasheet

Raspberry Pi Open-source Demo

Development Software

FAQ

 Answer:

RP2040-GEEK LCD controller is ST7789VW.

{{{5}}}


Support



Technical Support

If you need technical support or have any feedback/review, please click the Submit Now button to submit a ticket, Our support team will check and reply to you within 1 to 2 working days. Please be patient as we make every effort to help you to resolve the issue.
Working Time: 9 AM - 6 PM GMT+8 (Monday to Friday)