Skip to content

Commit 04dfa77

Browse files
pyhyscfriedt
authored andcommitted
boards: Add Adafruit Feather Canbus board
Add support for the Adafruit Feather Canbus board. The image is from https://learn.adafruit.com/assets/120914, with the license CC BY-SA 3.0. Signed-off-by: Jonas Berg <[email protected]>
1 parent f42dc20 commit 04dfa77

12 files changed

+544
-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_ADAFRUIT_FEATHER_CANBUS_RP2040
5+
select RP2_FLASH_W25Q080
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_ADAFRUIT_FEATHER_CANBUS_RP2040
5+
select SOC_RP2040
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_ADAFRUIT_FEATHER_CANBUS_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_ADAFRUIT_FEATHER_CANBUS_RP2040
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
/*
2+
* Copyright (c) 2025 Jonas Berg
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#include <dt-bindings/pinctrl/rpi-pico-rp2040-pinctrl.h>
8+
9+
&pinctrl {
10+
uart0_default: uart0_default {
11+
group1 {
12+
pinmux = <UART0_TX_P0>;
13+
};
14+
15+
group2 {
16+
pinmux = <UART0_RX_P1>;
17+
input-enable;
18+
};
19+
};
20+
21+
i2c1_default: i2c1_default {
22+
group1 {
23+
pinmux = <I2C1_SDA_P2>;
24+
input-enable;
25+
};
26+
27+
group2 {
28+
pinmux = <I2C1_SCL_P3>;
29+
input-enable;
30+
};
31+
};
32+
33+
spi1_default: spi1_default {
34+
group1 {
35+
pinmux = <SPI1_TX_P15>;
36+
};
37+
38+
group2 {
39+
pinmux = <SPI1_RX_P8>;
40+
input-enable;
41+
};
42+
43+
group3 {
44+
pinmux = <SPI1_SCK_P14>;
45+
};
46+
};
47+
48+
adc_default: adc_default {
49+
group1 {
50+
pinmux = <ADC_CH0_P26>, <ADC_CH1_P27>, <ADC_CH2_P28>, <ADC_CH3_P29>;
51+
input-enable;
52+
};
53+
};
54+
55+
ws2812_pio0_default: ws2812_pio0_default {
56+
group1 {
57+
pinmux = <PIO0_P21>;
58+
};
59+
};
60+
};
Lines changed: 229 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,229 @@
1+
/*
2+
* Copyright (c) 2021 Yonatan Schachter
3+
* Copyright (c) 2022 Peter Johanson
4+
* Copyright (c) 2025 Jonas Berg
5+
*
6+
* SPDX-License-Identifier: Apache-2.0
7+
*/
8+
9+
/dts-v1/;
10+
11+
#include <raspberrypi/rpi_pico/rp2040.dtsi>
12+
#include <dt-bindings/pinctrl/rpi-pico-rp2040-pinctrl.h>
13+
#include <zephyr/dt-bindings/input/input-event-codes.h>
14+
#include <zephyr/dt-bindings/led/led.h>
15+
#include "adafruit_feather_canbus_rp2040-pinctrl.dtsi"
16+
#include "feather_connector.dtsi"
17+
18+
/ {
19+
model = "Adafruit Feather RP2040 Canbus";
20+
compatible = "adafruit,feather_canbus_rp2040";
21+
22+
chosen {
23+
zephyr,sram = &sram0;
24+
zephyr,flash = &flash0;
25+
zephyr,flash-controller = &ssi;
26+
zephyr,console = &uart0;
27+
zephyr,shell-uart = &uart0;
28+
zephyr,code-partition = &code_partition;
29+
zephyr,canbus = &mcp2515;
30+
};
31+
32+
aliases {
33+
watchdog0 = &wdt0;
34+
led-strip = &ws2812;
35+
led0 = &red_led;
36+
sw0 = &user_button;
37+
};
38+
39+
zephyr,user {
40+
io-channels = <&adc 0>, <&adc 1>, <&adc 2>, <&adc 3>;
41+
};
42+
43+
leds: leds {
44+
compatible = "gpio-leds";
45+
46+
red_led: red_led {
47+
gpios = <&gpio0 13 GPIO_ACTIVE_HIGH>;
48+
label = "Red LED";
49+
};
50+
};
51+
52+
gpio_keys {
53+
compatible = "gpio-keys";
54+
55+
user_button: button {
56+
label = "User";
57+
gpios = <&gpio0 7 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
58+
zephyr,code = <INPUT_KEY_0>;
59+
};
60+
};
61+
62+
stemma_connector: stemma_connector {
63+
compatible = "stemma-qt-connector";
64+
#gpio-cells = <2>;
65+
gpio-map-mask = <0xffffffff 0xffffffc0>;
66+
gpio-map-pass-thru = <0 0x3f>;
67+
gpio-map = <0 0 &gpio0 3 0>, /* SCL */
68+
<1 0 &gpio0 2 0>; /* SDA */
69+
};
70+
};
71+
72+
&flash0 {
73+
reg = <0x10000000 DT_SIZE_M(8)>;
74+
75+
partitions {
76+
compatible = "fixed-partitions";
77+
#address-cells = <1>;
78+
#size-cells = <1>;
79+
80+
/* Reserved memory for the second stage bootloader */
81+
second_stage_bootloader: partition@0 {
82+
label = "second_stage_bootloader";
83+
reg = <0x00000000 0x100>;
84+
read-only;
85+
};
86+
87+
/*
88+
* Usable flash. Starts at 0x100, after the bootloader. The partition
89+
* size is 8 MB minus the 0x100 bytes taken by the bootloader.
90+
*/
91+
code_partition: partition@100 {
92+
label = "code-partition";
93+
reg = <0x100 (DT_SIZE_M(8) - 0x100)>;
94+
read-only;
95+
};
96+
};
97+
};
98+
99+
&gpio0 {
100+
status = "okay";
101+
102+
/* Power to Neopixel */
103+
neopixel-power-enable {
104+
gpio-hog;
105+
gpios = <20 GPIO_ACTIVE_HIGH>;
106+
output-high;
107+
};
108+
};
109+
110+
&uart0 {
111+
current-speed = <115200>;
112+
status = "okay";
113+
pinctrl-0 = <&uart0_default>;
114+
pinctrl-names = "default";
115+
};
116+
117+
zephyr_i2c: &i2c1 {
118+
status = "okay";
119+
pinctrl-0 = <&i2c1_default>;
120+
pinctrl-names = "default";
121+
clock-frequency = <I2C_BITRATE_FAST>;
122+
};
123+
124+
&spi1 {
125+
pinctrl-0 = <&spi1_default>;
126+
pinctrl-names = "default";
127+
status = "okay";
128+
cs-gpios = <&gpio0 19 GPIO_ACTIVE_LOW>;
129+
130+
mcp2515: mcp2515@0 {
131+
compatible = "microchip,mcp2515";
132+
spi-max-frequency = <1000000>;
133+
int-gpios = <&gpio0 22 GPIO_ACTIVE_LOW>;
134+
status = "okay";
135+
reg = <0x0>;
136+
osc-freq = <16000000>;
137+
138+
can-transceiver {
139+
max-bitrate = <1000000>;
140+
};
141+
};
142+
};
143+
144+
&timer {
145+
status = "okay";
146+
};
147+
148+
&wdt0 {
149+
status = "okay";
150+
};
151+
152+
&adc {
153+
status = "okay";
154+
pinctrl-0 = <&adc_default>;
155+
pinctrl-names = "default";
156+
#address-cells = <1>;
157+
#size-cells = <0>;
158+
159+
channel@0 {
160+
reg = <0>;
161+
zephyr,gain = "ADC_GAIN_1";
162+
zephyr,reference = "ADC_REF_INTERNAL";
163+
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
164+
zephyr,resolution = <12>;
165+
};
166+
167+
channel@1 {
168+
reg = <1>;
169+
zephyr,gain = "ADC_GAIN_1";
170+
zephyr,reference = "ADC_REF_INTERNAL";
171+
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
172+
zephyr,resolution = <12>;
173+
};
174+
175+
channel@2 {
176+
reg = <2>;
177+
zephyr,gain = "ADC_GAIN_1";
178+
zephyr,reference = "ADC_REF_INTERNAL";
179+
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
180+
zephyr,resolution = <12>;
181+
};
182+
183+
channel@3 {
184+
reg = <3>;
185+
zephyr,gain = "ADC_GAIN_1";
186+
zephyr,reference = "ADC_REF_INTERNAL";
187+
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
188+
zephyr,resolution = <12>;
189+
};
190+
};
191+
192+
&pio0 {
193+
status = "okay";
194+
pio-ws2812 {
195+
compatible = "worldsemi,ws2812-rpi_pico-pio";
196+
status = "okay";
197+
pinctrl-0 = <&ws2812_pio0_default>;
198+
pinctrl-names = "default";
199+
bit-waveform = <3>, <3>, <4>;
200+
201+
ws2812: ws2812 {
202+
status = "okay";
203+
gpios = <&gpio0 21 GPIO_ACTIVE_HIGH>;
204+
chain-length = <1>;
205+
color-mapping = <LED_COLOR_ID_GREEN
206+
LED_COLOR_ID_RED
207+
LED_COLOR_ID_BLUE>;
208+
reset-delay = <280>;
209+
frequency = <800000>;
210+
};
211+
};
212+
};
213+
214+
zephyr_udc0: &usbd {
215+
status = "okay";
216+
};
217+
218+
&die_temp {
219+
status = "okay";
220+
};
221+
222+
&vreg {
223+
regulator-always-on;
224+
regulator-allowed-modes = <REGULATOR_RPI_PICO_MODE_NORMAL>;
225+
};
226+
227+
&xosc {
228+
startup-delay-multiplier = <64>;
229+
};
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
identifier: adafruit_feather_canbus_rp2040
2+
name: Adafruit Feather RP2040 Adalogger
3+
type: mcu
4+
arch: arm
5+
flash: 8192
6+
ram: 264
7+
toolchain:
8+
- zephyr
9+
- gnuarmemb
10+
supported:
11+
- adc
12+
- can
13+
- clock
14+
- counter
15+
- dma
16+
- flash
17+
- gpio
18+
- hwinfo
19+
- i2c
20+
- pwm
21+
- spi
22+
- uart
23+
- watchdog
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Copyright (c) 2025 Jonas Berg
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
CONFIG_BUILD_OUTPUT_UF2=y
5+
CONFIG_CLOCK_CONTROL=y
6+
CONFIG_GPIO=y
7+
CONFIG_PIO_RPI_PICO=y
8+
CONFIG_RESET=y
9+
CONFIG_USE_DT_CODE_PARTITION=y
10+
CONFIG_SERIAL=y
11+
CONFIG_UART_INTERRUPT_DRIVEN=y
12+
CONFIG_CONSOLE=y
13+
CONFIG_UART_CONSOLE=y
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: adafruit_feather_canbus_rp2040
3+
full_name: Feather RP2040 CAN bus
4+
vendor: adafruit
5+
socs:
6+
- name: rp2040
Binary file not shown.

0 commit comments

Comments
 (0)