-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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. Signed-off-by: Henrik Brix Andersen <[email protected]>
- Loading branch information
1 parent
05c167e
commit 093f3b0
Showing
9 changed files
with
301 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Copyright (c) 2024-2025 Henrik Brix Andersen <[email protected]> | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
config BOARD_CANBARDO | ||
select SOC_SAME70N20B |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Copyright (c) 2024-2025 Henrik Brix Andersen <[email protected]> | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
board_runner_args(jlink "--device=ATSAME70N20B") | ||
|
||
include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
board: | ||
name: canbardo | ||
full_name: CANbardo | ||
vendor: others | ||
socs: | ||
- name: same70n20b |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* Copyright (c) 2024-2025 Henrik Brix Andersen <[email protected]> | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
#include <dt-bindings/pinctrl/same70n-pinctrl.h> | ||
|
||
&pinctrl { | ||
uart1_default: uart1_default { | ||
group1 { | ||
pinmux = <PA5C_UART1_RXD>, | ||
<PA4C_UART1_TXD>; | ||
}; | ||
}; | ||
|
||
can0_default: can0_default { | ||
group1 { | ||
pinmux = <PB3A_CAN0_RX>, | ||
<PB2A_CAN0_TX>; | ||
}; | ||
}; | ||
|
||
can1_default: can1_default { | ||
group1 { | ||
pinmux = <PD28B_CAN1_RX>, | ||
<PD12B_CAN1_TX>; | ||
}; | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,160 @@ | ||
/* | ||
* Copyright (c) 2024-2025 Henrik Brix Andersen <[email protected]> | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
/dts-v1/; | ||
|
||
#include <freq.h> | ||
#include <mem.h> | ||
#include <atmel/same70x20b.dtsi> | ||
#include <zephyr/dt-bindings/gpio/gpio.h> | ||
#include <zephyr/dt-bindings/input/input-event-codes.h> | ||
|
||
#include "canbardo-pinctrl.dtsi" | ||
|
||
/ { | ||
model = "CANbardo board"; | ||
compatible = "canbardo", "atmel,same70n20b", "atmel,same70b"; | ||
|
||
chosen { | ||
zephyr,console = &uart1; | ||
zephyr,shell-uart = &uart1; | ||
zephyr,sram = &sram0; | ||
zephyr,flash = &flash0; | ||
zephyr,code-partition = &slot0_partition; | ||
zephyr,canbus = &can0; | ||
}; | ||
|
||
aliases { | ||
led0 = &dfu_led; | ||
sw0 = &sw; | ||
mcuboot-led0 = &dfu_led; | ||
mcuboot-button0 = &sw; | ||
}; | ||
|
||
leds { | ||
compatible = "gpio-leds"; | ||
|
||
dfu_led: dfu_led { | ||
gpios = <&piod 9 GPIO_ACTIVE_LOW>; | ||
label = "DFU LED"; | ||
}; | ||
|
||
can_0_ledr: can_0_ledr { | ||
gpios = <&piod 25 GPIO_ACTIVE_LOW>; | ||
label = "CAN0 LED ERR"; | ||
}; | ||
|
||
can_0_ledg: can_0_ledg { | ||
gpios = <&piod 22 GPIO_ACTIVE_LOW>; | ||
label = "CAN0 LED RDY"; | ||
}; | ||
|
||
can_0_ledy: can_0_ledy { | ||
gpios = <&piod 24 GPIO_ACTIVE_LOW>; | ||
label = "CAN0 LED ACT"; | ||
}; | ||
|
||
can_1_ledr: can_1_ledr { | ||
gpios = <&piod 19 GPIO_ACTIVE_LOW>; | ||
label = "CAN1 LED ERR"; | ||
}; | ||
|
||
can_1_ledg: can_1_ledg { | ||
gpios = <&piod 17 GPIO_ACTIVE_LOW>; | ||
label = "CAN1 LED RDY"; | ||
}; | ||
|
||
can_1_ledy: can_1_ledy { | ||
gpios = <&piod 18 GPIO_ACTIVE_LOW>; | ||
label = "CAN1 LED ACT"; | ||
}; | ||
}; | ||
|
||
gpio_keys { | ||
compatible = "gpio-keys"; | ||
|
||
sw: sw { | ||
label = "SW"; | ||
gpios = <&piod 15 GPIO_ACTIVE_LOW>; | ||
zephyr,code = <INPUT_KEY_0>; | ||
}; | ||
}; | ||
|
||
transceiver0: can-phy0 { | ||
compatible = "microchip,mcp2558fd", "can-transceiver-gpio"; | ||
enable-gpios = <&piod 26 GPIO_ACTIVE_LOW>; | ||
max-bitrate = <8000000>; | ||
#phy-cells = <0>; | ||
}; | ||
|
||
transceiver1: can-phy1 { | ||
compatible = "microchip,mcp2558fd", "can-transceiver-gpio"; | ||
enable-gpios = <&piod 20 GPIO_ACTIVE_LOW>; | ||
max-bitrate = <8000000>; | ||
#phy-cells = <0>; | ||
}; | ||
}; | ||
|
||
&cpu0 { | ||
clock-frequency = <DT_FREQ_M(300)>; | ||
}; | ||
|
||
&uart1 { | ||
status = "okay"; | ||
current-speed = <115200>; | ||
pinctrl-0 = <&uart1_default>; | ||
pinctrl-names = "default"; | ||
}; | ||
|
||
zephyr_udc0: &usbhs { | ||
status = "okay"; | ||
}; | ||
|
||
&can0 { | ||
status = "okay"; | ||
pinctrl-0 = <&can0_default>; | ||
pinctrl-names = "default"; | ||
phys = <&transceiver0>; | ||
}; | ||
|
||
&can1 { | ||
status = "okay"; | ||
pinctrl-0 = <&can1_default>; | ||
pinctrl-names = "default"; | ||
phys = <&transceiver1>; | ||
}; | ||
|
||
&flash0 { | ||
partitions { | ||
compatible = "fixed-partitions"; | ||
#address-cells = <1>; | ||
#size-cells = <1>; | ||
|
||
/* First half of sector 0 */ | ||
boot_partition: partition@0 { | ||
label = "mcuboot"; | ||
reg = <0x0 DT_SIZE_K(64)>; | ||
read-only; | ||
}; | ||
|
||
/* From sector 1 to sector 3 (included) */ | ||
slot0_partition: partition@20000 { | ||
label = "image-0"; | ||
reg = <0x00020000 DT_SIZE_K(384)>; | ||
}; | ||
|
||
/* From sector 4 to sector 6 (included) */ | ||
slot1_partition: partition@80000 { | ||
label = "image-1"; | ||
reg = <0x00080000 DT_SIZE_K(384)>; | ||
}; | ||
|
||
/* Sector 7 */ | ||
storage_partition: partition@e0000 { | ||
label = "storage"; | ||
reg = <0x000e0000 DT_SIZE_K(128)>; | ||
}; | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Copyright (c) 2024-2025 Henrik Brix Andersen <[email protected]> | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
identifier: canbardo/same70n20b | ||
name: CANbardo | ||
type: mcu | ||
arch: arm | ||
toolchain: | ||
- zephyr | ||
- gnuarmemb | ||
flash: 1024 | ||
ram: 384 | ||
supported: | ||
- can | ||
- gpio | ||
- usb | ||
- usb_device | ||
vendor: others |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Copyright (c) 2024-2025 Henrik Brix Andersen <[email protected]> | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
CONFIG_ARM_MPU=y | ||
CONFIG_CACHE_MANAGEMENT=y | ||
CONFIG_HW_STACK_PROTECTION=y | ||
|
||
CONFIG_CONSOLE=y | ||
CONFIG_SERIAL=y | ||
CONFIG_UART_CONSOLE=y |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
.. zephyr:board:: canbardo | ||
Overview | ||
******** | ||
|
||
CANbardo is an open hardware Universal Serial Bus (USB) to Controller Area Network (CAN) adapter | ||
board. It is designed to be compatible with the open source :ref:`external_module_cannectivity`. | ||
|
||
Hardware | ||
******** | ||
|
||
The CANbardo board is equipped with an Atmel SAME70N20B microcontroller and features an USB-C | ||
connector (high-speed USB 2.0), two DB-9M connectors for CAN FD (up to 8 Mbit/s), a number of status | ||
LEDs, and a push button. Schematics and component placement drawings are available in the `CANbardo | ||
GitHub repository`_. | ||
|
||
Supported Features | ||
================== | ||
|
||
The ``canbardo`` board supports the following hardware features: | ||
|
||
+-----------+------------+-------------------------------------+ | ||
| Interface | Controller | Driver/Component | | ||
+===========+============+=====================================+ | ||
| NVIC | on-chip | nested vector interrupt controller | | ||
+-----------+------------+-------------------------------------+ | ||
| PINMUX | on-chip | pinmux | | ||
+-----------+------------+-------------------------------------+ | ||
| FLASH | on-chip | flash memory | | ||
+-----------+------------+-------------------------------------+ | ||
| GPIO | on-chip | gpio | | ||
+-----------+------------+-------------------------------------+ | ||
| USB | on-chip | USB | | ||
+-----------+------------+-------------------------------------+ | ||
| UART1 | on-chip | serial console | | ||
+-----------+------------+-------------------------------------+ | ||
| CAN0 | on-chip | CAN controller | | ||
+-----------+------------+-------------------------------------+ | ||
| CAN1 | on-chip | CAN controller | | ||
+-----------+------------+-------------------------------------+ | ||
|
||
The default configuration can be found in the defconfig file: | ||
:zephyr_file:`boards/others/canbardo/canbardo_defconfig`. | ||
|
||
Other hardware features are not currently supported by the port. | ||
|
||
System Clock | ||
============ | ||
|
||
The SAME70N20B is driven by a 12 MHz crystal and configured to provide a system clock of 300 | ||
MHz. The two CAN FD controllers have a core clock frequency of 80 MHz. | ||
|
||
Programming and Debugging | ||
************************* | ||
|
||
Build and flash applications as usual (see :ref:`build_an_application` and | ||
:ref:`application_run` for more details). | ||
|
||
Here is an example for the :zephyr:code-sample:`blinky` application. | ||
|
||
.. zephyr-app-commands:: | ||
:zephyr-app: samples/basic/blinky | ||
:board: canbardo | ||
:Goals: flash | ||
|
||
.. _CANbardo GitHub repository: | ||
https://github.com/CANbardo/canbardo |