Programming the RP2040 Zero Microcontroller
To begin, it is necessary to study the architecture and features of the RP2040 controller.
Find the datasheet online for specifications:
RP2040 Microcontroller
Dual-core Arm Cortex M0+ with a flexible clock frequency up to 133 MHz
264 KB SRAM and 2 MB built-in flash memory
USB-C connector
Supports USB 1.1 Host and Device modes
Low-power sleep modes
29× multifunctional GPIO contacts
2× SPI, 2× I2C, 2× UART, 3× 12-bit ADC, 16× controlled PWM channels
Calibrated generator and timers for precise time intervals
Temperature sensor
Floating-point calculation accelerator
8× programmable input-output state machines (PIO) for custom peripheral support
Pay attention to the pinout of the board, as it is crucial when addressing specific pins. The LED pin is 16.
Find the "Raspberry Pi Pico SDK Getting Started" file.
Navigate to Chapter 9, "Building on Other Platforms," then 9.2, "Building on MS Windows."
Download the Pico version via the provided link.
Open Pico Visual Studio Code, compile all examples by clicking the build button.
Choose a program to compile, for example, "Hello World." Since RP2040 doesn't have display peripherals, the message is output to the virtual port. Identify the virtual port by checking the device manager for the USB serial interface.
In the Pico environment, select the "Hello World" category, find the USB file, and click build.Open the build tab, find the "Hello World" file with the .uf2 extension.
Open it in File Explorer and copy it to the controller. Connect the controller via USB, hold the boot button on the board, and it will appear as a flash drive. Open the serial monitor in the Pico environment, check if the ports match, and click start. The output message should be visible at the bottom.Tried to do the same for the "Blink" example, but the LED seems not to work. Attempted to run the program in the Arduino IDE compiler with similar results. The code for Arduino IDE was composed with the help of the GPT chat. Tried changing pins, but the result is currently unsatisfactory. The program loads, but nothing happens.
During endless searches, it was determined that there is a built-in WS2812 LED, and to communicate with it, it is not sufficient to simply specify the correct pin.
It is necessary to install the special Neopixel library.
To do this, search for the Adafruit_NeoPixel-1.12.0 library online, download it in zip format. In the Arduino IDE, open the "Sketch/Include Library/Manage Libraries" tab, select "Add .zip Library," find the downloaded file in the dialog window, and install the library.
You can download the required file here: https://github.com/adafruit/Adafruit_NeoPixel/releases.
Next, insert the necessary program code and upload it to the controller. Observe the results.
And this is the use of CircuitPython. It's very convenient that there is an option to connect online. There is no need to install additional code editors. It is available here: https://code.circuitpython.org/
When opening, it is necessary to select the device we are programming and the port where this device is available.
Enter the code, press "Run and Save," save it on the controller with a specific name, and observe the results.
Arduino sketch here