Cytron Maker Pi RP2040
Overview
The Cytron Maker Pi RP2040 [1] board is based on the RP2040 microcontroller from Raspberry Pi Ltd. The board has motor drivers, servo headers, Grove connectors and a micro USB connector.
Hardware
Microcontroller Raspberry Pi RP2040, with a max frequency of 133 MHz
Dual ARM Cortex M0+ cores
264 kByte SRAM
2 Mbyte QSPI flash
17 GPIO pins
3 ADC pins
Supply voltage measurement
I2C
UART
Micro USB connector
LiPo charger
Reset, boot and 2 user buttons
2 RGB LEDs (Neopixels)
Piezo buzzer with mute switch
4 servo ports
2 Motor drivers, with 4 manual test bottons
7 Grove connectors, of which one can be used as a Maker/Qwiic/Stemma QT/zephyr_i2c connector
13 status indicators for digital pins
Default Zephyr Peripheral Mapping
Description |
Pin |
Default pin mux |
Zephyr PWM name |
|---|---|---|---|
RGB LEDs |
GPIO18 |
PIO0 |
|
Buzzer |
GPIO22 |
PWM3A |
6 |
Button 1 |
GPIO20 |
(Alias sw0) |
|
Button 2 |
GPIO21 |
(Alias sw1) |
|
Voltage sense |
GPIO29 |
ADC3, voltage divider |
Servo header:
Label |
Pin |
Default pin mux |
Zephyr PWM name |
|---|---|---|---|
GP12 |
GPIO12 |
PWM6A |
12 |
GP13 |
GPIO13 |
PWM6B |
13 |
GP14 |
GPIO14 |
PWM7A |
14 |
GP15 |
GPIO15 |
PWM7B |
15 |
Motor drivers:
Label |
Pin |
Default pin mux |
Zephyr PWM name |
|---|---|---|---|
M1A |
GPIO8 |
PWM4A |
8 |
M1B |
GPIO9 |
PWM4B |
9 |
M2A |
GPIO10 |
PWM5A |
10 |
M2B |
GPIO11 |
PWM5B |
11 |
Grove connector 1:
Label |
Pin |
Default pin mux |
|---|---|---|
GP0 |
GPIO0 |
UART0 TX |
GP1 |
GPIO1 |
UART0 RX |
Grove connector 2:
Use an adapter cable to connect Qwiic/Stemma QT sensors (that use I2C) to this connector, which
is mapped to the zephyr_i2c devicetree node label.
Label |
Pin |
Default pin mux |
|---|---|---|
GP2 |
GPIO2 |
I2C1 SDA |
GP3 |
GPIO3 |
I2C1 SCL |
Grove connector 3:
Label |
Pin |
Notes |
|---|---|---|
GP4 |
GPIO4 |
Alias led0 |
GP5 |
GPIO5 |
Alias led1 |
Grove connector 4:
Label |
Pin |
|---|---|
GP16 |
GPIO16 |
GP17 |
GPIO17 |
Grove connector 5:
Label |
Pin |
Default pin mux |
Notes |
|---|---|---|---|
GP6 |
GPIO6 |
||
GP26 |
GPIO26 |
ADC0 |
Also in Grove 6 |
Grove connector 6:
Label |
Pin |
Default pin mux |
Notes |
|---|---|---|---|
GP26 |
GPIO26 |
ADC0 |
Also in Grove 5 |
GP27 |
GPIO27 |
ADC1 |
Grove connector 7:
Label |
Pin |
Default pin mux |
|---|---|---|
GP7 |
GPIO7 |
|
GP28 |
GPIO28 |
ADC2 |
Supported Features
The maker_pi_rp2040 board supports the hardware features listed below.
- on-chip / on-board
- Feature integrated in the SoC / present on the board.
- 2 / 2
-
Number of instances that are enabled / disabled.
Click on the label to see the first instance of this feature in the board/SoC DTS files. -
vnd,foo -
Compatible string for the Devicetree binding matching the feature.
Click on the link to view the binding documentation.
maker_pi_rp2040/rp2040 target
Type |
Location |
Description |
Compatible |
|---|---|---|---|
CPU |
on-chip |
ARM Cortex-M0+ CPU2 |
|
ADC |
on-chip |
Raspberry Pi Pico ADC1 |
|
Clock control |
on-chip |
Raspberry Pi Pico clock controller node1 |
|
on-chip |
|||
on-chip |
The representation of Raspberry Pi Pico’s PLL2 |
||
on-chip |
The representation of Raspberry Pi Pico ring oscillator1 |
||
on-chip |
The representation of Raspberry Pi Pico external oscillator1 |
||
Counter |
on-chip |
Raspberry Pi Pico timer1 |
|
DMA |
on-chip |
Raspberry Pi Pico DMA1 |
|
Flash controller |
on-chip |
Raspberry Pi Pico flash controller1 |
|
GPIO & Headers |
on-chip |
Raspberry Pi Pico GPIO1 |
|
on-chip |
Raspberry Pi Pico GPIO Port1 |
||
on-board |
GPIO pins exposed on Grove 4 pins headers7 |
||
I2C |
on-chip |
||
IIO |
on-board |
Voltage Divider1 |
|
Input |
on-board |
Group of GPIO-bound input keys1 |
|
Interrupt controller |
on-chip |
ARMv6-M NVIC (Nested Vectored Interrupt Controller) controller1 |
|
LED |
on-board |
Group of GPIO-controlled LEDs1 |
|
LED strip |
on-board |
The pio node configured for ws28121 |
|
Miscellaneous |
on-chip |
||
MTD |
on-chip |
Flash node1 |
|
on-board |
Fixed partitions of a flash (or other non-volatile storage) memory1 |
||
Pin control |
on-chip |
Raspberry Pi Pico Pin Controller1 |
|
PWM |
on-chip |
Raspberry Pi Pico PWM1 |
|
Regulator |
on-chip |
Raspberry Pi Pico core supply regurator1 |
|
Reset controller |
on-chip |
Raspberry Pi Pico Reset Controller1 |
|
RTC |
on-chip |
Raspberry Pi Pico RTC1 |
|
Sensors |
on-chip |
Raspberry Pi Pico family temperature sensor node1 |
|
Serial controller |
on-chip |
||
SPI |
on-chip |
Raspberry Pi Pico SPI2 |
|
SRAM |
on-chip |
Generic on-chip SRAM1 |
|
Timer |
on-chip |
ARMv6-M System Tick1 |
|
USB |
on-chip |
Raspberry Pi Pico USB Device Controller1 |
|
Watchdog |
on-chip |
Raspberry Pi Pico Watchdog1 |
Programming and Debugging
The maker_pi_rp2040 board supports the runners and associated west commands listed below.
| flash | debug | attach | debugserver | rtt | |
|---|---|---|---|---|---|
| blackmagicprobe | ✅ | ✅ | ✅ | ||
| jlink | ✅ | ✅ | ✅ | ✅ | ✅ |
| openocd | ✅ | ✅ (default) | ✅ | ✅ | ✅ |
| pyocd | ✅ | ✅ | ✅ | ✅ | ✅ |
| uf2 | ✅ (default) |
By default programming is done via the USB connector. Press and hold the BOOT button, and then
press the RST button, and the device will appear as a USB mass storage unit.
Building your application will result in a build/zephyr/zephyr.uf2 file.
Drag and drop the file to the USB mass storage unit, and the board will be reprogrammed.
It is also possible to program and debug the board via the SWDIO and SWCLK pins in the DEBUG
connector. You must solder a 3-pin header to the board in order to use this feature.
A separate programming hardware tool is required, and for example the openocd software
is used. Typically the OPENOCD and OPENOCD_DEFAULT_PATH values should be set when
building, and the --runner openocd argument should be used when flashing.
For more details on programming RP2040-based boards, see Programming and Debugging.
Flashing
To run the Blinky sample:
# From the root of the zephyr repository
west build -b maker_pi_rp2040 samples/basic/blinky/
west flash
Try also the LED strip, Hello World, Button, Input dump and Analog-to-Digital Converter (ADC) with devicetree samples.
The use of the Maker/Qwiic/Stemma QT I2C connector (Grove 2) is demonstrated using the Generic Light Sensor Polling sample and a separate shield:
# From the root of the zephyr repository
west build -b maker_pi_rp2040 --shield adafruit_veml7700 samples/sensor/light_polling
west flash
Use the shell to control the GPIO pins:
# From the root of the zephyr repository
west build -b maker_pi_rp2040 samples/sensor/sensor_shell -- -DCONFIG_GPIO=y -DCONFIG_GPIO_SHELL=y
west flash
To set one of the GPIO pins high, use these commands in the shell, and study the indicator LEDs:
gpio conf gpio0 16 o
gpio set gpio0 16 1
Servo motor control is done via PWM outputs. The Servomotor sample sets servo position timing (via an overlay file) for the output GP12:
# From the root of the zephyr repository
west build -b maker_pi_rp2040 samples/basic/servo_motor/
west flash
It is also possible to control servos via the pwm shell:
# From the root of the zephyr repository
west build -b maker_pi_rp2040 samples/sensor/sensor_shell -- -DCONFIG_PWM=y -DCONFIG_PWM_SHELL=y
west flash
Use shell commands to set the position of the servo. Most servo motors can handle pulse times between 800 and 2000 microseconds:
pwm usec pwm@40050000 12 20000 800
pwm usec pwm@40050000 12 20000 2000
To use the buzzer, you must turn on the buzzer switch on the short side of the board. Then build using the same command as above for the sensor_shell. Use these shell commands to turn on and off the buzzer:
pwm usec pwm@40050000 6 1000 500
pwm usec pwm@40050000 6 1000 0
You can also control the motor outputs via the shell. To set the speed of motor 1 to 100%, 50%, 20% and 0% respectively, use these commands:
pwm usec pwm@40050000 8 1000 1000
pwm usec pwm@40050000 8 1000 500
pwm usec pwm@40050000 8 1000 200
pwm usec pwm@40050000 8 1000 0
To run the motor in the opposite direction at 80%:
pwm usec pwm@40050000 9 1000 800
The sensor_shell sample is used also to measure the supply voltage. This is the result when running on a Vin voltage slightly less than 6 Volt:
sensor get vbatt
channel type=33(voltage) index=0 shift=3 num_samples=1 value=32688380776ns (5.977999)