Skip to content

Commit 8b313bd

Browse files
Henrik Brix AndersenChromeos LUCI
authored andcommitted
boards: others: add support for the CANbardo USB to CAN adapter board
Add support for the open hardware CANbardo Universal Serial Bus (USB) to Controller Area Network (CAN) adapter board. (cherry picked from commit 31f5819) Original-Signed-off-by: Henrik Brix Andersen <[email protected]> GitOrigin-RevId: 31f5819 Cr-Build-Id: 8726132470642320465 Cr-Build-Url: https://cr-buildbucket.appspot.com/build/8726132470642320465 Copybot-Job-Name: zephyr-main-copybot-downstream Change-Id: I0085bc17df5dce145cadfdef68dfae9b24628b4b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/zephyr/+/6167305 Tested-by: ChromeOS Prod (Robot) <[email protected]> Reviewed-by: Keith Short <[email protected]> Reviewed-by: Jonathon Murphy <[email protected]> Commit-Queue: Dawid Niedźwiecki <[email protected]> Tested-by: Keith Short <[email protected]>
1 parent b039e6f commit 8b313bd

File tree

9 files changed

+301
-0
lines changed

9 files changed

+301
-0
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Copyright (c) 2024-2025 Henrik Brix Andersen <[email protected]>
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
config BOARD_CANBARDO
5+
select SOC_SAME70N20B

boards/others/canbardo/board.cmake

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Copyright (c) 2024-2025 Henrik Brix Andersen <[email protected]>
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
board_runner_args(jlink "--device=ATSAME70N20B")
5+
6+
include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake)

boards/others/canbardo/board.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
board:
2+
name: canbardo
3+
full_name: CANbardo
4+
vendor: others
5+
socs:
6+
- name: same70n20b
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
* Copyright (c) 2024-2025 Henrik Brix Andersen <[email protected]>
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
#include <dt-bindings/pinctrl/same70n-pinctrl.h>
7+
8+
&pinctrl {
9+
uart1_default: uart1_default {
10+
group1 {
11+
pinmux = <PA5C_UART1_RXD>,
12+
<PA4C_UART1_TXD>;
13+
};
14+
};
15+
16+
can0_default: can0_default {
17+
group1 {
18+
pinmux = <PB3A_CAN0_RX>,
19+
<PB2A_CAN0_TX>;
20+
};
21+
};
22+
23+
can1_default: can1_default {
24+
group1 {
25+
pinmux = <PD28B_CAN1_RX>,
26+
<PD12B_CAN1_TX>;
27+
};
28+
};
29+
};
Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
/*
2+
* Copyright (c) 2024-2025 Henrik Brix Andersen <[email protected]>
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
/dts-v1/;
7+
8+
#include <freq.h>
9+
#include <mem.h>
10+
#include <atmel/same70x20b.dtsi>
11+
#include <zephyr/dt-bindings/gpio/gpio.h>
12+
#include <zephyr/dt-bindings/input/input-event-codes.h>
13+
14+
#include "canbardo-pinctrl.dtsi"
15+
16+
/ {
17+
model = "CANbardo board";
18+
compatible = "canbardo", "atmel,same70n20b", "atmel,same70b";
19+
20+
chosen {
21+
zephyr,console = &uart1;
22+
zephyr,shell-uart = &uart1;
23+
zephyr,sram = &sram0;
24+
zephyr,flash = &flash0;
25+
zephyr,code-partition = &slot0_partition;
26+
zephyr,canbus = &can0;
27+
};
28+
29+
aliases {
30+
led0 = &dfu_led;
31+
sw0 = &sw;
32+
mcuboot-led0 = &dfu_led;
33+
mcuboot-button0 = &sw;
34+
};
35+
36+
leds {
37+
compatible = "gpio-leds";
38+
39+
dfu_led: dfu_led {
40+
gpios = <&piod 9 GPIO_ACTIVE_LOW>;
41+
label = "DFU LED";
42+
};
43+
44+
can_0_ledr: can_0_ledr {
45+
gpios = <&piod 25 GPIO_ACTIVE_LOW>;
46+
label = "CAN0 LED ERR";
47+
};
48+
49+
can_0_ledg: can_0_ledg {
50+
gpios = <&piod 22 GPIO_ACTIVE_LOW>;
51+
label = "CAN0 LED RDY";
52+
};
53+
54+
can_0_ledy: can_0_ledy {
55+
gpios = <&piod 24 GPIO_ACTIVE_LOW>;
56+
label = "CAN0 LED ACT";
57+
};
58+
59+
can_1_ledr: can_1_ledr {
60+
gpios = <&piod 19 GPIO_ACTIVE_LOW>;
61+
label = "CAN1 LED ERR";
62+
};
63+
64+
can_1_ledg: can_1_ledg {
65+
gpios = <&piod 17 GPIO_ACTIVE_LOW>;
66+
label = "CAN1 LED RDY";
67+
};
68+
69+
can_1_ledy: can_1_ledy {
70+
gpios = <&piod 18 GPIO_ACTIVE_LOW>;
71+
label = "CAN1 LED ACT";
72+
};
73+
};
74+
75+
gpio_keys {
76+
compatible = "gpio-keys";
77+
78+
sw: sw {
79+
label = "SW";
80+
gpios = <&piod 15 GPIO_ACTIVE_LOW>;
81+
zephyr,code = <INPUT_KEY_0>;
82+
};
83+
};
84+
85+
transceiver0: can-phy0 {
86+
compatible = "microchip,mcp2558fd", "can-transceiver-gpio";
87+
enable-gpios = <&piod 26 GPIO_ACTIVE_LOW>;
88+
max-bitrate = <8000000>;
89+
#phy-cells = <0>;
90+
};
91+
92+
transceiver1: can-phy1 {
93+
compatible = "microchip,mcp2558fd", "can-transceiver-gpio";
94+
enable-gpios = <&piod 20 GPIO_ACTIVE_LOW>;
95+
max-bitrate = <8000000>;
96+
#phy-cells = <0>;
97+
};
98+
};
99+
100+
&cpu0 {
101+
clock-frequency = <DT_FREQ_M(300)>;
102+
};
103+
104+
&uart1 {
105+
status = "okay";
106+
current-speed = <115200>;
107+
pinctrl-0 = <&uart1_default>;
108+
pinctrl-names = "default";
109+
};
110+
111+
zephyr_udc0: &usbhs {
112+
status = "okay";
113+
};
114+
115+
&can0 {
116+
status = "okay";
117+
pinctrl-0 = <&can0_default>;
118+
pinctrl-names = "default";
119+
phys = <&transceiver0>;
120+
};
121+
122+
&can1 {
123+
status = "okay";
124+
pinctrl-0 = <&can1_default>;
125+
pinctrl-names = "default";
126+
phys = <&transceiver1>;
127+
};
128+
129+
&flash0 {
130+
partitions {
131+
compatible = "fixed-partitions";
132+
#address-cells = <1>;
133+
#size-cells = <1>;
134+
135+
/* First half of sector 0 */
136+
boot_partition: partition@0 {
137+
label = "mcuboot";
138+
reg = <0x0 DT_SIZE_K(64)>;
139+
read-only;
140+
};
141+
142+
/* From sector 1 to sector 3 (included) */
143+
slot0_partition: partition@20000 {
144+
label = "image-0";
145+
reg = <0x00020000 DT_SIZE_K(384)>;
146+
};
147+
148+
/* From sector 4 to sector 6 (included) */
149+
slot1_partition: partition@80000 {
150+
label = "image-1";
151+
reg = <0x00080000 DT_SIZE_K(384)>;
152+
};
153+
154+
/* Sector 7 */
155+
storage_partition: partition@e0000 {
156+
label = "storage";
157+
reg = <0x000e0000 DT_SIZE_K(128)>;
158+
};
159+
};
160+
};
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Copyright (c) 2024-2025 Henrik Brix Andersen <[email protected]>
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
identifier: canbardo/same70n20b
5+
name: CANbardo
6+
type: mcu
7+
arch: arm
8+
toolchain:
9+
- zephyr
10+
- gnuarmemb
11+
flash: 1024
12+
ram: 384
13+
supported:
14+
- can
15+
- gpio
16+
- usb
17+
- usb_device
18+
vendor: others
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Copyright (c) 2024-2025 Henrik Brix Andersen <[email protected]>
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
CONFIG_ARM_MPU=y
5+
CONFIG_CACHE_MANAGEMENT=y
6+
CONFIG_HW_STACK_PROTECTION=y
7+
8+
CONFIG_CONSOLE=y
9+
CONFIG_SERIAL=y
10+
CONFIG_UART_CONSOLE=y
35.5 KB
Loading
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
.. zephyr:board:: canbardo
2+
3+
Overview
4+
********
5+
6+
CANbardo is an open hardware Universal Serial Bus (USB) to Controller Area Network (CAN) adapter
7+
board. It is designed to be compatible with the open source :ref:`external_module_cannectivity`.
8+
9+
Hardware
10+
********
11+
12+
The CANbardo board is equipped with an Atmel SAME70N20B microcontroller and features an USB-C
13+
connector (high-speed USB 2.0), two DB-9M connectors for CAN FD (up to 8 Mbit/s), a number of status
14+
LEDs, and a push button. Schematics and component placement drawings are available in the `CANbardo
15+
GitHub repository`_.
16+
17+
Supported Features
18+
==================
19+
20+
The ``canbardo`` board supports the following hardware features:
21+
22+
+-----------+------------+-------------------------------------+
23+
| Interface | Controller | Driver/Component |
24+
+===========+============+=====================================+
25+
| NVIC | on-chip | nested vector interrupt controller |
26+
+-----------+------------+-------------------------------------+
27+
| PINMUX | on-chip | pinmux |
28+
+-----------+------------+-------------------------------------+
29+
| FLASH | on-chip | flash memory |
30+
+-----------+------------+-------------------------------------+
31+
| GPIO | on-chip | gpio |
32+
+-----------+------------+-------------------------------------+
33+
| USB | on-chip | USB |
34+
+-----------+------------+-------------------------------------+
35+
| UART1 | on-chip | serial console |
36+
+-----------+------------+-------------------------------------+
37+
| CAN0 | on-chip | CAN controller |
38+
+-----------+------------+-------------------------------------+
39+
| CAN1 | on-chip | CAN controller |
40+
+-----------+------------+-------------------------------------+
41+
42+
The default configuration can be found in the defconfig file:
43+
:zephyr_file:`boards/others/canbardo/canbardo_defconfig`.
44+
45+
Other hardware features are not currently supported by the port.
46+
47+
System Clock
48+
============
49+
50+
The SAME70N20B is driven by a 12 MHz crystal and configured to provide a system clock of 300
51+
MHz. The two CAN FD controllers have a core clock frequency of 80 MHz.
52+
53+
Programming and Debugging
54+
*************************
55+
56+
Build and flash applications as usual (see :ref:`build_an_application` and
57+
:ref:`application_run` for more details).
58+
59+
Here is an example for the :zephyr:code-sample:`blinky` application.
60+
61+
.. zephyr-app-commands::
62+
:zephyr-app: samples/basic/blinky
63+
:board: canbardo
64+
:Goals: flash
65+
66+
.. _CANbardo GitHub repository:
67+
https://github.com/CANbardo/canbardo

0 commit comments

Comments
 (0)