diff --git a/boards/others/canbardo/Kconfig.canbardo b/boards/others/canbardo/Kconfig.canbardo new file mode 100644 index 00000000000..dd82cb29466 --- /dev/null +++ b/boards/others/canbardo/Kconfig.canbardo @@ -0,0 +1,5 @@ +# Copyright (c) 2024-2025 Henrik Brix Andersen +# SPDX-License-Identifier: Apache-2.0 + +config BOARD_CANBARDO + select SOC_SAME70N20B diff --git a/boards/others/canbardo/board.cmake b/boards/others/canbardo/board.cmake new file mode 100644 index 00000000000..470cf0a5322 --- /dev/null +++ b/boards/others/canbardo/board.cmake @@ -0,0 +1,6 @@ +# Copyright (c) 2024-2025 Henrik Brix Andersen +# SPDX-License-Identifier: Apache-2.0 + +board_runner_args(jlink "--device=ATSAME70N20B") + +include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake) diff --git a/boards/others/canbardo/board.yml b/boards/others/canbardo/board.yml new file mode 100644 index 00000000000..096e332f896 --- /dev/null +++ b/boards/others/canbardo/board.yml @@ -0,0 +1,6 @@ +board: + name: canbardo + full_name: CANbardo + vendor: others + socs: + - name: same70n20b diff --git a/boards/others/canbardo/canbardo-pinctrl.dtsi b/boards/others/canbardo/canbardo-pinctrl.dtsi new file mode 100644 index 00000000000..18a4cb01c72 --- /dev/null +++ b/boards/others/canbardo/canbardo-pinctrl.dtsi @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2024-2025 Henrik Brix Andersen + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +&pinctrl { + uart1_default: uart1_default { + group1 { + pinmux = , + ; + }; + }; + + can0_default: can0_default { + group1 { + pinmux = , + ; + }; + }; + + can1_default: can1_default { + group1 { + pinmux = , + ; + }; + }; +}; diff --git a/boards/others/canbardo/canbardo.dts b/boards/others/canbardo/canbardo.dts new file mode 100644 index 00000000000..294365c7a95 --- /dev/null +++ b/boards/others/canbardo/canbardo.dts @@ -0,0 +1,160 @@ +/* + * Copyright (c) 2024-2025 Henrik Brix Andersen + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; + +#include +#include +#include +#include +#include + +#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 = ; + }; + }; + + 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 = ; +}; + +&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)>; + }; + }; +}; diff --git a/boards/others/canbardo/canbardo.yaml b/boards/others/canbardo/canbardo.yaml new file mode 100644 index 00000000000..fab283bb573 --- /dev/null +++ b/boards/others/canbardo/canbardo.yaml @@ -0,0 +1,18 @@ +# Copyright (c) 2024-2025 Henrik Brix Andersen +# 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 diff --git a/boards/others/canbardo/canbardo_defconfig b/boards/others/canbardo/canbardo_defconfig new file mode 100644 index 00000000000..9f4016571d2 --- /dev/null +++ b/boards/others/canbardo/canbardo_defconfig @@ -0,0 +1,10 @@ +# Copyright (c) 2024-2025 Henrik Brix Andersen +# 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 diff --git a/boards/others/canbardo/doc/canbardo.webp b/boards/others/canbardo/doc/canbardo.webp new file mode 100644 index 00000000000..48ec7164061 Binary files /dev/null and b/boards/others/canbardo/doc/canbardo.webp differ diff --git a/boards/others/canbardo/doc/index.rst b/boards/others/canbardo/doc/index.rst new file mode 100644 index 00000000000..e0cccb91d9d --- /dev/null +++ b/boards/others/canbardo/doc/index.rst @@ -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