RP2040-ETH

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

RP2040
Type-C, ETH
{{{name2}}}

{{{name3}}}

{{{name4}}}

{{{name5}}}

{{{name6}}}

Overview

Introduction

RP2040-ETH is a mini RP2040-ETH development board, which integrates TCP/IP protocol stack for network communication. 14 × multi-function GPIO pins and the castellated holes on its PCB edges allow easy and quick integration into projects.

Features

  • Adopts RP2040 micro-controller chip designed by the official Raspberry Pi.
  • Dual-core Arm Cortex M0+ processor, flexible clock running up to 133 MHz.
  • Built-in 264KB of SRAM, and 4MB of onboard Flash memory.
  • Onboard CH9120 with integrated TCP/IP protocol stack.
  • With the host software and serial commands, you can set the network parameters such as chip operating mode, port, and IP.
  • The castellated module allows soldering directly to carrier boards.
  • Drag-and-drop programming using mass storage over USB.
  • 14 × multi-function GPIO pins, compatible with some Pico HATs.
  • More hardware peripherals:
    • 1x SPI (SPI0)
    • 2x I2C
    • 2x UART
    • 13x Controllable PWM channels
  • Built-in temperature sensor.
  • 8 × Programmable I/O (PIO) state machines for custom peripheral support.

Pinout Definition

RP2040-ETH02.jpg

RP2040-ETH User Manual

Environment Building

  • C/C++ Development Environment Installation
  • MicroPython Development Environment Installation:
    • Download the software according to your system from Thonny.
    • After installing, please configure the language and the environment for the first time. Note that we should choose the Raspberry Pi option in the board environment.

Pico-R3-Tonny1.png

    • Configure the Micrpython environment and select the Pico port.
      • First connect the Raspberry Pi Pico to the computer, left-click on the configuration environment option in the lower right corner of Thonny --> select configure an interpreter.
      • In the pop-up window bar, select MicroPython (Raspberry Pi Pico), and select the corresponding port.

Raspberry Pi Pico002.png
Raspberry-Pi-Pico-Basic-Kit-M-3.png

    • Click OK to return to the main interface of Thonny, download the firmware library to Pico, and then click the stop button to display the currently used environment in the Shell window.
    • Pico download firmware library method in Windows: After connecting the computer, press and hold the BOOT and RESET buttons at the same time, release the RESET button first, and then release the BOOT button, a removable disk will appear on the computer and copy the firmware library into it.
    • The Raspberry Pi system is similar to the Windows system, the Raspberry Pi needs to install the latest version of the system with the desktop.
  • Arduino IDE Development Environment Installation:
    • Open Arduino IDE, enter File -> Preferences
    • In the pop-up dialog box, enter the following URL in the "Additional Boards Manager URLs" field:
https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json
    • Click "OK" to close the dialog box.
    • Go to Tools -> Board Manager in IDE.
    • Type "pico" in the search box and select "Add".

Hardware Connection

  • The internal connection between CH9120 and RP2040 as shown below:
RP2040 connection pins correspondence
CH9120 RP2040 Function
RXD GP21 Serial data input
TXD GP20 Serial data output
TCPCS GP17 In TCP client mode, indicates connection status, low level for successful connection
CFG0 GP18 Network configuration enabled pin, low level for serial debugging mode
RSTI GP19 Reset, active LOW

Demo Usage

In Raspberry Pi

  • Open the Raspberry Pi terminal, and run:
cd ~
sudo wget https://files.waveshare.com/upload/3/36/RP2040_ETH_CODE.zip
unzip RP2040_ETH_CODE.zip
cd ~/RP2040_ETH_CODE

C

  • The following guide is operated in the Raspberry Pi. As CMake is multi-platform and portable, it can also be compiled on the PC. But the operation steps are different, you can explore it by yourselves.
  • Before compiling, you should make sure it is in C/RP2040-ETH-Demo/build directory:
  • Enter the build directory and add SDK:
  • .../.../pico -sdk is your SDK directory.
cd C/RP2040-ETH-Demo/build/
export PICO_SDK_PATH=../../pico-sdk
#Note: write the correct SDK path 
cmake ..
#Execute make to generate the executable file and it takes a long time to compile for the first time 
make -j9
#Compilatio is finished, uf2 file is created.
  • After connecting RP2040-ETH to the Raspberry Pi, you should press the BOOT and RESET keys at the same time. Release the RESET key first, and then the BOOT key. A portable disk will appear on the computer, and you can copy the firmware library to it.
cp main.uf2 /media/pi/RPI-RP2/

Python

  • After connecting the RP2040-ETH to the Raspberry Pi, press the BOOT key and the RESET key at the same time. Release the RESET key, then the BOOT key and a removable disk are shown on the computer.
  • Copy ~/RP2040_ETH_CODE/Python/rp2-pico-20230209-unstable-v1.19.1.uf2 file to the RP2040.
  • Open the Thonny IDE on your Raspberry Pi (click on the Raspberry logo -> Programming -> Thonny Python IDE), you can check the version information in Help -> About Thonny.
  • To make sure your version has the Pico support package, also you can click on Tools -> Options... -> Interpreter to select MicroPicoPython (Raspberry Pi Pico) and ttyACM0 port.

As shown below:
Pico-lcd-0.96-img-config2.png

    • If your current Thonny version has no Pico support package, you can enter the following commands to update Thonny IDE.
sudo apt upgrade thonny
  • Click File -> Open... -> RP2040_ETH_CODE/Python/RP2040-ETH-Demo.py, run the demo.

In Windows Environment

C

  • Firstly, install Visual Studio Code.
  • After installing, open the Visual Studio Code expansion interface (Ctrl + Shift + X).
  • Type CMake Tools and install.
  • Press F1 and type open settings UI to open the settings UI screen.
  • Search for CMake.configureEnvironment.
  • Click Add item.
Item Value
PICO_SDK_PATH [storage PICO-SDK path]\pico-sdk
  • "[storage PICO-SDK path]\pico-sdk" is the path you store SDK, and it can not be compiled when the path is wrong.
  • Search cmake.generator, and fill in:
NMake Makefiles
#Ctrl+S to save the setting, clear the build file folder, reboot Visual Studio Code, and compile again.
  • Click to download the demo, unzip and then enter the RP2040_ETH_CODE file folder.
  • After entering RP2040_ETH_CODE\C\RP2040-ETH-Demo, open the project with vs code.

RP2040-ETH010.jpg

  • Choose the Compiler.

1.28inch Touch LCD pico2.jpg

  • Start to compile.

1.28inch Touch LCD pico3.jpg

  • Finish.

1.28inch Touch LCD pico4.jpg

  • Copy the main.uf2 file in build to Pico, and then it can automatically run the demo.

1.28inch Touch LCD pico5.jpg

Python

  1. After connecting RP2040-ETH to the computer, press and hold down the BOOT and RESET keys at the same time, release the RESET button, and then release the BOOT. A removable disk appears on the computer.
  2. Copy the rp2-pico-20230209-unstable-v1.19.1.uf2 file in the Python directory to the recognized movable disk(RPI-RP2).
  3. Open Thonny IDE. (Note: please use the latest version of Thonny, otherwise there is no Pico supporting package. Currently, the newest version in Windows is v3.3.3.)
  4. Click Tool -> Setting -> Explainer. select the Pico and the corresponding port as shown below:
    Pico-lcd-0.96-img-config.png
  5. File -> Open -> RP2040-ETH-Demo.py, click to run, the effect is shown below.

1.28inch Touch LCD pico7.jpg
This demo provides only a simple test program.

Host Debugging

  • If you want to control the host configuration rather than the serial commands, you can refer to the following method, and this method is only for Windows systems.
  • Download Network debugging tool.
  1. Power on RP2040-ETH and the Ethernet.
  2. Open the network and tool.
  3. Search the device -> double click the searched device -> set the information you require -> Configure the device parameters -> wait for rebooting.

RP2040-ETH 30.jpg

  • Follows steps 1 and 2 in the above figure, and configure the parameters in the red block. Please wait for 4 after step 3.

Sample Demo

C/C++ Demo

1. Network Configuration

  • The code for configuring the operating mode, IP, gateway, subnet mask, port number, and serial port baud rate is in the CH9120.c or CH9120.cpp file. You can modify it according to your specific requirements.
UCHAR CH9120_Mode = TCP_CLIENT; //Optional: TCP_SERVER, TCP_CLIENT, UDP_SERVER, UDP_CLIENT
UCHAR CH9120_LOCAL_IP[4] = {192, 168, 10, 205};   // LOCAL IP
UCHAR CH9120_GATEWAY[4] = {192, 168, 11, 1};      // GATEWAY
UCHAR CH9120_SUBNET_MASK[4] = {255, 255, 252, 0}; // SUBNET MASK
UCHAR CH9120_TARGET_IP[4] = {192, 168, 10, 137};  // TARGET_IP
UWORD CH9120_PORT1 = 1000;                        // LOCAL PORT1
UWORD CH9120_TARGET_PORT = 2000;                  // TARGET PORT
UDOUBLE CH9120_BAUD_RATE = 115200;                // BAUD RATE
  • The various operating modes are already defined in the header file, so you can directly modify and use CH9120_Mode.
#define TCP_SERVER 0
#define TCP_CLIENT 1
#define UDP_SERVER 2
#define UDP_CLIENT 3

2. Hardware Interface

  • Enter configure mode:
void CH9120_Start();
  • Exit:
void CH9120_End();
  • Configure working mode:
void CH9120_SetMode(UCHAR Mode);
  • Configure local IP:
void CH9120_SetLocalIP(UCHAR CH9120_LOCAL_IP[]);
  • Configure subnet mask:
void CH9120_SetSubnetMask(UCHAR CH9120_SUBNET_MASK[]);
  • Configure gateway:
void CH9120_SetGateway(UCHAR CH9120_GATEWAY[]);
  • Configure target IP:
void CH9120_SetTargetIP(UCHAR CH9120_TARGET_IP[]);
  • Configure local port number:
void CH9120_SetLocalPort(UWORD CH9120_PORT);
  • Configure target port number:
void CH9120_SetTargetPort(UWORD CH9120_TARGET_PORT);
  • Configure baud rate:
void CH9120_SetBaudRate(UDOUBLE CH9120_BAUD_RATE);

3. Demo Expalnation
The main demo code is shown below:

int Pico_ETH_CH9120_test(void)
{
    CH9120_init(); //Initialize Configuration CH9120
    RX_TX();       //receive and dispatch
}
  • CH9120_init();
    Invoking various hardware interfaces to initialize and configure the CH9120.
  • RX_TX();
    After initializing the CH9120, call RX_TX() to enter the data transmission mode, the CH9120 will resend the received message back (limited to ASCII code strings) automatically.

4. Running Effect

  • Open the network debugging tool, configure the TCP server, and wait for RP2040-ETH to initiate the connection. Please observe the prompt in the lower right corner to check if the connection is successful.
    RP2040-ETH-Demo-show1.png
  • Data transmission test:
    RP2040-ETH-Demo-show2.png

MicroPython Demo

01-TCP/UDP

1. Network Configuration
The code for configuring the operating mode, IP, gateway, subnet mask, port number, and serial port baud rate is located in the Python/RP2040-ETH-Demo/RP2040-ETH-Demo.py file. You can modify it according to your specific requirements.

MODE = 1  #0:TCP Server 1:TCP Client 2:UDP Server 3:UDP Client
GATEWAY = (192, 168, 1, 1)    # GATEWAY
TARGET_IP = (192, 168, 1, 10) # TARGET_IP
LOCAL_IP = (192, 168, 1, 200) # LOCAL_IP
SUBNET_MASK = (255,255,255,0) # SUBNET_MASK
LOCAL_PORT1 = 1000            # LOCAL_PORT1
TARGET_PORT = 2000            # TARGET_PORT
BAUD_RATE = 115200            # BAUD_RATE

2. Hardware Interface
The configuration functions for CH9120 are all in the Python/RP2040-ETH-Demo/ch9120.py file. The demos import the CH9120 class and then utilize the CH9120 object to call the functions.

  • Create a new object:
ch9120 = CH9120(uart1)
  • Enter configure mode:
ch9120.enter_config()
  • Exit:
ch9120.exit_config()
  • Configure working mode:
ch9120.set_mode(MODE)
  • Configure local IP:
ch9120.set_localIP(LOCAL_IP)
  • Configure subnet mask:
ch9120.set_subnetMask(SUBNET_MASK)
  • Configure gateway:
ch9120.set_gateway(GATEWAY)
  • Configure local port number:
ch9120.set_localPort(LOCAL_PORT1)
  • Configure target IP:
ch9120.set_targetIP(TARGET_IP)
  • Configure target port number:
ch9120.set_targetPort(TARGET_PORT)
  • Configure baud rate:
ch9120.set_baudRate(BAUD_RATE)

3. Demo Explanation
The main demo code is shown below:

if __name__ == "__main__":
    ch9120_configure()
    while True:
        time.sleep(0.1)
        while uart1.any() > 0:
            rxData1 = uart1.read(uart1.any())
            uart1.write(rxData1)
            print(rxData1.decode('utf8'))
  • ch9120_configure()
    Invoking various hardware interfaces to initialize and configure the CH9120.
  • After initializing the CH9120, enter the data transmission mode, the CH9120 will resend the received message back (limited to ASCII code strings).

4. Running Effect

  • Program the micropython firmware, upload ch9120.py, run the demo.
    RP2040-ETH-Python-Demo-config.jpg
  • Open the network debugging tool, configure the TCP server, and wait for RP2040-ETH to initiate the connection. Please observe the prompt in the lower right corner to check if the connection is successful.
    RP2040-ETH-Demo-show1.png
  • Data transmission test:
    RP2040-ETH-Demo-show2.png

02-MQTT

1. Network Setting
The configuration code for MQTT communication based on the TCP/IP protocol and for CH9120 is located in the Python/RP2040-ETH-Demo/RP2040-ETH-MQTT.py file.

# MQTT
CLIENT_ID = "Waveshare_RP2040_ETH"
SUBSCRIBE_TOPIC = "test_topic1"
PUBLISH_TOPIC = "test_topic2"
# CH9120
MODE = 1  #0:TCP Server 1:TCP Client 2:UDP Server 3:UDP Client
GATEWAY = (192, 168, 1, 1)     # GATEWAY
TARGET_IP = (47, 92, 129, 18)  # TARGET_IP
LOCAL_IP = (192, 168, 1, 200)  # LOCAL_IP
SUBNET_MASK = (255,255,255,0)  # SUBNET_MASK
LOCAL_PORT1 = 1000             # LOCAL_PORT1
TARGET_PORT = 1883             # TARGET_PORT
BAUD_RATE = 115200             # BAUD_RATE

The following are the related variables of MQTT, you can modify them according to your needs.

CLIENT_ID: client ID
SUBSCRIBE_TOPIC: subscribe topic name  
PUBLISH_TOPIC: the topic to be published  
TARGET_IP: MQTT server IP
TARGET_PORT: MQTT server communication port  

2. Interface Function

  • Create MQTT client object:
mqtt_client = MQTTClient(uart1)
  • Initiate to connect:
mqtt_client.connect()
  • Subscribe to the topic:
mqtt_client.subscribe(SUBSCRIBE_TOPIC)
  • Publish the message:
mqtt_client.publish(PUBLISH_TOPIC, message)
  • Send a heartbeat packet:
mqtt_client.send_heartbeat()
  • Check heartbeat response
mqtt_client.check_heartbeat_response()
  • Extract data:
mqtt_client.extract_data(rxData)

3. Demo Explanation
The main demo code is shown below:

if __name__ == "__main__":
    ch9120_configure()
    mqtt_client = MQTTClient(uart1)
    mqtt_client.ClientID = CLIENT_ID # Set ClientID
    mqtt_client.connect() # Connect to MQTT server
    mqtt_client.subscribe(SUBSCRIBE_TOPIC) # Subscribe to topic:test_topic1

    while True:
        rxData = uart1.read()
        if rxData is not None:
            topic, message = mqtt_client.extract_data(rxData) # Parse the received data
            if topic == SUBSCRIBE_TOPIC:
                print("Topic:", topic)
                print("Message:", message)
                mqtt_client.publish(PUBLISH_TOPIC, message) # Send received data to topic:test_topic2
        time.sleep_ms(20)

This code segment first configures the CH9120 and then establishes a connection to the MQTT server's communication port and subscribed to a specific topic by sending byte data.

ch9120_configure()
mqtt_client = MQTTClient(uart1)
mqtt_client.ClientID = CLIENT_ID # Set ClientID
mqtt_client.connect() # Connect to MQTT server
mqtt_client.subscribe(SUBSCRIBE_TOPIC) # Subscribe to topic:test_topic1
  • ch9120_configure()
    Invoking various hardware interfaces to initialize and configure the CH9120.
  • mqtt_client = MQTTClient(uart1)
    Create the MQTT client object "mqtt_client"
  • mqtt_client.ClientID = CLIENT_ID
    Configure the client ID
  • mqtt_client.connect()
    Initiate a connection request to the MQTT server
  • mqtt_client.subscribe(SUBSCRIBE_TOPIC)
    Subscribe the topic

This code segment signifies entering data transmission mode, where the received messages are sent back from another topic.

while True:
    rxData = uart1.read()
    if rxData is not None:
        topic, message = mqtt_client.extract_data(rxData) # Parse the received data
        if topic == SUBSCRIBE_TOPIC:
            print("Topic:", topic)
            print("Message:", message)
            mqtt_client.publish(PUBLISH_TOPIC, message) # Send received data to topic:test_topic2
    time.sleep_ms(20)
  • rxData = uart1.read()
    Read the data
  • topic, message = mqtt_client.extract_data(rxData)
    Parse the data, extract the topic and message from the data.
  • if topic == SUBSCRIBE_TOPIC
    Prints the topic name and message if it is a subscribed topic.
  • mqtt_client.publish(PUBLISH_TOPIC, message)
    Sends the received messages back from another topic.

After the connection is established, the client needs to make sure the intervals between sending two MQTT protocols will not exceed Keep Alive value. If the client currently is idle, and there is no packet to be sent, you can send PINGREQ protocol packet (heartbeat packet). If the MQTT server does not receive any packets from the client within 1.5 times the Keep Alive time, it will assume that there is a problem with the connection between the client and the MQTT server, and the server will disconnect from the client. Therefore, if the client does not send packets for a long time and wants to keep the connection, it needs to send heartbeat packets every once in a while, and it is usually recommended to send them once in half of the Keep Alive time. The following code means to send a heartbeat packet to the server every 30 seconds, if the heartbeat check fails, it will reconnect until the heartbeat check succeeds and exit:

current_time = time.time()
    if current_time - last_heartbeat_time >= 30:
    last_heartbeat_time = current_time
    mqtt_client.send_heartbeat()
    if not mqtt_client.check_heartbeat_response():
        while True:
            mqtt_client.send_heartbeat()
            if mqtt_client.check_heartbeat_response():
                break
  • mqtt_client.send_heartbeat()
    Send a heartbeat packet to the MQTT server, it is usually recommended to send it once within half of the Keep Alive time, in the program Keep Alive is set to 60 seconds, so it is sent once every 30 seconds.
  • mqtt_client.check_heartbeat_response()
    Check the heartbeat response returned by the MQTT server, if the returned data is normal, then exit the loop, if not, then continue to try to reconnect.

4. Running Effect

  • Program the micropython firmware, and upload ch9120.py and mqtt_client.py, run the demo.
    RP2040-ETH-Python-MQTT-config.jpg
  • Open the MQTT client test tool, and configure the MQTT client. After configuring, click on "Connect" in the top right corner.
    RP2040-ETH-MQTT-show1.jpg
  • Subscribe to the topic.
    RP2040-ETH-MQTT-show2.jpg
  • The data transmission test, sends the message to test_topic1, and the RP2040-ETH receives and sends back a message via the test_topic2 topic.
    RP2040-ETH-MQTT-show3.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)


Resource

Document

Demo

Tool

Raspberry Pi

Examples

Software

FAQ

 Answer:

The default serial baud rate of the board is 9600, which may cause the delay issue. Please change it to the maximum baud rate and test again.

{{{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)