Skip to content

Commit 9334ced

Browse files
pyhyscfriedt
authored andcommitted
boards: Add support for Cytron Maker Nano RP2040
Tested with the commands in index.rst Product photo from https://github.com/CytronTechnologies/MAKER-NANO-RP2040/ blob/main/MAKER-NANO-RP2040-Image.PNG Signed-off-by: Jonas Berg <jonas.s.t.berg@gmail.com>
1 parent 1db1e69 commit 9334ced

File tree

12 files changed

+616
-0
lines changed

12 files changed

+616
-0
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Copyright (c) 2025 Jonas Berg
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
config BOARD_MAKER_NANO_RP2040
5+
select RP2_FLASH_W25Q080
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Copyright (c) 2022 Peter Johanson
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
if BOARD_MAKER_NANO_RP2040
5+
6+
if I2C_DW
7+
8+
config I2C_DW_CLOCK_SPEED
9+
default 125
10+
11+
endif # I2C_DW
12+
13+
config USB_SELF_POWERED
14+
default n
15+
16+
endif # BOARD_MAKER_NANO_RP2040
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Copyright (c) 2025 Jonas Berg
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
config BOARD_MAKER_NANO_RP2040
5+
select SOC_RP2040
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/*
2+
* Copyright (c) 2022 Joylab AG
3+
* Copyright (c) 2025 Tomas Jurena
4+
* Copyright (c) 2025 Jonas Berg
5+
*
6+
* SPDX-License-Identifier: Apache-2.0
7+
*/
8+
9+
#include <zephyr/dt-bindings/gpio/arduino-nano-header.h>
10+
11+
/ {
12+
arduino_header: connector {
13+
compatible = "arduino-nano-header";
14+
#gpio-cells = <2>;
15+
gpio-map-mask = <0xffffffff 0xffffffc0>;
16+
gpio-map-pass-thru = <0 0x3f>;
17+
gpio-map = <ARDUINO_NANO_HEADER_D0 0 &gpio0 0 0>, /* D0 / UART0-RX */
18+
<ARDUINO_NANO_HEADER_D1 0 &gpio0 1 0>, /* D1 / UART0-TX */
19+
<ARDUINO_NANO_HEADER_D2 0 &gpio0 2 0>, /* D2 */
20+
<ARDUINO_NANO_HEADER_D3 0 &gpio0 3 0>, /* D3 */
21+
<ARDUINO_NANO_HEADER_D4 0 &gpio0 4 0>, /* D4 */
22+
<ARDUINO_NANO_HEADER_D5 0 &gpio0 5 0>, /* D5 */
23+
<ARDUINO_NANO_HEADER_D6 0 &gpio0 6 0>, /* D6 */
24+
<ARDUINO_NANO_HEADER_D7 0 &gpio0 7 0>, /* D7 */
25+
<ARDUINO_NANO_HEADER_D8 0 &gpio0 8 0>, /* D8 */
26+
<ARDUINO_NANO_HEADER_D9 0 &gpio0 9 0>, /* D9 */
27+
<ARDUINO_NANO_HEADER_D10 0 &gpio0 17 0>, /* D10 / SPI0-CS */
28+
<ARDUINO_NANO_HEADER_D11 0 &gpio0 19 0>, /* D11 / SPI0-MOSI */
29+
<ARDUINO_NANO_HEADER_D12 0 &gpio0 16 0>, /* D12 / SPI0-MISO */
30+
<ARDUINO_NANO_HEADER_D13 0 &gpio0 18 0>, /* D13 / SPI0-SCK */
31+
<ARDUINO_NANO_HEADER_A0 0 &gpio0 26 0>, /* D14 / A0 / I2C1-SDA */
32+
<ARDUINO_NANO_HEADER_A1 0 &gpio0 27 0>, /* D15 / A1 / I2C1-SCL */
33+
<ARDUINO_NANO_HEADER_A2 0 &gpio0 28 0>, /* D16 / A2 */
34+
<ARDUINO_NANO_HEADER_A3 0 &gpio0 29 0>, /* D17 / A3 */
35+
<ARDUINO_NANO_HEADER_A4 0 &gpio0 12 0>, /* D18 / A4 / I2C0-SDA */
36+
<ARDUINO_NANO_HEADER_A5 0 &gpio0 13 0>, /* D19 / A5 / I2C0-SCL */
37+
<ARDUINO_NANO_HEADER_A6 0 &gpio0 14 0>, /* D20 / A6 */
38+
<ARDUINO_NANO_HEADER_A7 0 &gpio0 15 0>; /* D21 / A7 */
39+
};
40+
};
41+
42+
arduino_nano_spi: &spi0 {};
43+
44+
arduino_nano_serial: &uart0 {};
45+
46+
arduino_nano_i2c: &i2c0 {};
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
# Copyright (c) 2023 TOKITA Hiroshi
3+
4+
board_runner_args(uf2 "--board-id=RPI-RP2")
5+
6+
include(${ZEPHYR_BASE}/boards/common/uf2.board.cmake)
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
board:
2+
name: maker_nano_rp2040
3+
full_name: Cytron Maker Nano RP2040
4+
vendor: cytron
5+
socs:
6+
- name: rp2040
17.6 KB
Loading
Lines changed: 212 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,212 @@
1+
.. zephyr:board:: maker_nano_rp2040
2+
3+
Overview
4+
********
5+
6+
The `Cytron Maker Nano RP2040`_ board is based on the RP2040 microcontroller from Raspberry Pi Ltd.
7+
The board has an Arduino Nano header, Maker/Qwiic/Stemma QT connectors and a mikro USB connector.
8+
9+
10+
Hardware
11+
********
12+
13+
- Microcontroller Raspberry Pi RP2040, with a max frequency of 133 MHz
14+
- Dual ARM Cortex M0+ cores
15+
- 264 kByte SRAM
16+
- 2 Mbyte QSPI flash
17+
- 20 GPIO pins
18+
- 2 ADC pins
19+
- I2C
20+
- SPI
21+
- UART
22+
- Mikro USB connector
23+
- Reset, boot and user buttons
24+
- 2 RGB LEDs (Neopixels)
25+
- Piezo buzzer with mute switch
26+
- Maker/Qwiic/Stemma QT/zephyr_i2c connectors
27+
- Status indicators for digital pins
28+
29+
30+
Default Zephyr Peripheral Mapping
31+
=================================
32+
33+
+-------------+--------+-----------------+-------------------+
34+
| Label | Pin | Default pin mux | Notes |
35+
+=============+========+=================+===================+
36+
| RGB LEDs | GPIO11 | PIO0 | |
37+
+-------------+--------+-----------------+-------------------+
38+
| User button | GPIO20 | | Alias sw0 |
39+
+-------------+--------+-----------------+-------------------+
40+
| Buzzer | GPIO22 | PWM3A | Zephyr PWM name 6 |
41+
+-------------+--------+-----------------+-------------------+
42+
43+
44+
Arduino Nano header:
45+
46+
+-------+--------+-----------------+-------------------+
47+
| Label | Pin | Default pin mux | Also in connector |
48+
+=======+========+=================+===================+
49+
| 0 | GPIO0 | UART0 TX | Maker port 0 |
50+
+-------+--------+-----------------+-------------------+
51+
| 1 | GPIO1 | UART0 RX | Maker port 0 |
52+
+-------+--------+-----------------+-------------------+
53+
| RS | Reset | | |
54+
+-------+--------+-----------------+-------------------+
55+
| G | GND | | |
56+
+-------+--------+-----------------+-------------------+
57+
| 2 | GPIO2 | | (Alias led0) |
58+
+-------+--------+-----------------+-------------------+
59+
| 3 | GPIO3 | | |
60+
+-------+--------+-----------------+-------------------+
61+
| 4 | GPIO4 | | |
62+
+-------+--------+-----------------+-------------------+
63+
| 5 | GPIO5 | | |
64+
+-------+--------+-----------------+-------------------+
65+
| 6 | GPIO6 | | |
66+
+-------+--------+-----------------+-------------------+
67+
| 7 | GPIO7 | | |
68+
+-------+--------+-----------------+-------------------+
69+
| 8 | GPIO8 | | |
70+
+-------+--------+-----------------+-------------------+
71+
| 9 | GPIO9 | | |
72+
+-------+--------+-----------------+-------------------+
73+
| 17 | GPIO17 | SPI0 CS | |
74+
+-------+--------+-----------------+-------------------+
75+
| 19 | GPIO19 | SPI0 MOSI | |
76+
+-------+--------+-----------------+-------------------+
77+
| 16 | GPIO16 | SPI0 MISO | |
78+
+-------+--------+-----------------+-------------------+
79+
| 18 | GPIO18 | SPI0 SCK | |
80+
+-------+--------+-----------------+-------------------+
81+
| 3V3 | 3.3 V | | |
82+
+-------+--------+-----------------+-------------------+
83+
| NC | | | |
84+
+-------+--------+-----------------+-------------------+
85+
| 26 | GPIO26 | I2C1 SDA | Maker port 1 |
86+
+-------+--------+-----------------+-------------------+
87+
| 27 | GPIO27 | I2C1 SCL | Maker port 1 |
88+
+-------+--------+-----------------+-------------------+
89+
| 28 | GPIO28 | ADC2 | |
90+
+-------+--------+-----------------+-------------------+
91+
| 29 | GPIO29 | ADC3 | |
92+
+-------+--------+-----------------+-------------------+
93+
| 12 | GPIO12 | I2C0 SDA | |
94+
+-------+--------+-----------------+-------------------+
95+
| 13 | GPIO13 | I2C0 SCL | |
96+
+-------+--------+-----------------+-------------------+
97+
| 14 | GPIO14 | | |
98+
+-------+--------+-----------------+-------------------+
99+
| 15 | GPIO15 | | |
100+
+-------+--------+-----------------+-------------------+
101+
| 5V | 5 V | | |
102+
+-------+--------+-----------------+-------------------+
103+
| RS | Reset | | |
104+
+-------+--------+-----------------+-------------------+
105+
| G | GND | | |
106+
+-------+--------+-----------------+-------------------+
107+
| VIN | Vin | | |
108+
+-------+--------+-----------------+-------------------+
109+
110+
111+
Maker port 0 (pins also available in the Arduino Nano header):
112+
113+
+--------+-----------------+
114+
| Pin | Default pin mux |
115+
+========+=================+
116+
| GPIO0 | UART0 TX |
117+
+--------+-----------------+
118+
| GPIO1 | UART0 RX |
119+
+--------+-----------------+
120+
121+
122+
Maker port 1, also known as Qwiic/Stemma QT/zephyr_i2c. Pins also available in the Arduino
123+
Nano header:
124+
125+
+--------+-----------------+
126+
| Pin | Default pin mux |
127+
+========+=================+
128+
| GPIO26 | I2C1 SDA |
129+
+--------+-----------------+
130+
| GPIO27 | I2C1 SCL |
131+
+--------+-----------------+
132+
133+
See also `pinout`_.
134+
135+
136+
Supported Features
137+
==================
138+
139+
.. zephyr:board-supported-hw::
140+
141+
142+
Programming and Debugging
143+
*************************
144+
145+
.. zephyr:board-supported-runners::
146+
147+
The Maker Nano RP2040 board does not expose the SWDIO and SWCLK pins, so programming must be
148+
done via the USB port. Press and hold the BOOT button, and then press the RST button,
149+
and the device will appear as a USB mass storage unit.
150+
Building your application will result in a :file:`build/zephyr/zephyr.uf2` file.
151+
Drag and drop the file to the USB mass storage unit, and the board will be reprogrammed.
152+
153+
For more details on programming RP2040-based boards, see :ref:`rpi_pico_programming_and_debugging`.
154+
155+
156+
Flashing
157+
========
158+
159+
To run the :zephyr:code-sample:`led-strip` sample:
160+
161+
.. zephyr-app-commands::
162+
:zephyr-app: samples/drivers/led/led_strip/
163+
:board: maker_nano_rp2040
164+
:goals: build flash
165+
166+
Try also the :zephyr:code-sample:`hello_world`, :zephyr:code-sample:`blinky`,
167+
:zephyr:code-sample:`button`, :zephyr:code-sample:`input-dump` and
168+
:zephyr:code-sample:`adc_dt` samples.
169+
170+
The use of the Maker Port 1/Qwiic/Stemma QT I2C connector is demonstrated using the
171+
:zephyr:code-sample:`light_sensor_polling` sample and a separate shield:
172+
173+
.. zephyr-app-commands::
174+
:zephyr-app: samples/sensor/light_polling
175+
:board: maker_nano_rp2040
176+
:shield: adafruit_veml7700
177+
:goals: build flash
178+
179+
Use the shell to control the GPIO pins:
180+
181+
.. zephyr-app-commands::
182+
:zephyr-app: samples/sensor/sensor_shell
183+
:board: maker_nano_rp2040
184+
:gen-args: -DCONFIG_GPIO=y -DCONFIG_GPIO_SHELL=y
185+
:goals: build flash
186+
187+
To set one of the GPIO pins high, use these commands in the shell, and study the indicator LEDs:
188+
189+
.. code-block:: shell
190+
191+
gpio conf gpio0 2 o
192+
gpio set gpio0 2 1
193+
194+
Turn on the buzzer switch on the short side of the board. Then build using the same command
195+
as above for the sensor_shell. Use these shell commands to turn on and off the buzzer:
196+
197+
.. code-block:: shell
198+
199+
pwm usec pwm@40050000 6 1000 500
200+
pwm usec pwm@40050000 6 1000 0
201+
202+
203+
References
204+
**********
205+
206+
.. target-notes::
207+
208+
.. _Cytron Maker Nano RP2040:
209+
https://www.cytron.io/c-maker-series/p-maker-nano-rp2040-simplifying-projects-with-raspberry-pi-rp2040
210+
211+
.. _pinout:
212+
https://docs.google.com/drawings/d/e/2PACX-1vSGwfh_1ac_UFXT4F72D0yJHaYHjDC-lfeBMLp0dc8ry57sAYtdobIFBZqrfXE6AuDTYEY9Cicto2b8/pub?w=3373&h=2867
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
/*
2+
* Copyright (c) 2025 Jonas Berg
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#include <zephyr/dt-bindings/pinctrl/rpi-pico-rp2040-pinctrl.h>
8+
9+
&pinctrl {
10+
adc_default: adc_default {
11+
group1 {
12+
pinmux = <ADC_CH2_P28>, <ADC_CH3_P29>;
13+
input-enable;
14+
};
15+
};
16+
17+
spi0_default: spi0_default {
18+
group1 {
19+
pinmux = <SPI0_CSN_P17>, <SPI0_SCK_P18>, <SPI0_TX_P19>;
20+
};
21+
22+
group2 {
23+
pinmux = <SPI0_RX_P16>;
24+
input-enable;
25+
};
26+
};
27+
28+
i2c0_default: i2c0_default {
29+
group1 {
30+
pinmux = <I2C0_SDA_P12>, <I2C0_SCL_P13>;
31+
input-enable;
32+
};
33+
};
34+
35+
i2c1_default: i2c1_default {
36+
group1 {
37+
pinmux = <I2C1_SDA_P26>, <I2C1_SCL_P27>;
38+
input-enable;
39+
};
40+
};
41+
42+
uart0_default: uart0_default {
43+
group1 {
44+
pinmux = <UART0_TX_P0>;
45+
};
46+
47+
group2 {
48+
pinmux = <UART0_RX_P1>;
49+
input-enable;
50+
};
51+
};
52+
53+
pwm_default: pwm_default {
54+
group1 {
55+
pinmux = <PWM_3A_P22>;
56+
};
57+
};
58+
59+
ws2812_pio0_default: ws2812_pio0_default {
60+
ws2812 {
61+
pinmux = <PIO0_P11>;
62+
};
63+
};
64+
};

0 commit comments

Comments
 (0)