Skip to content

Commit 3825c85

Browse files
henrikbrixandersennashif
authored andcommitted
boards: fysetc: add FYSETC UCAN USB to CAN 2.0B adapter board
Add support for the open-source FYSETC UCAN USB to CAN 2.0B board. Signed-off-by: Henrik Brix Andersen <[email protected]>
1 parent 7f5351b commit 3825c85

File tree

9 files changed

+212
-0
lines changed

9 files changed

+212
-0
lines changed

boards/fysetc/index.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
.. _boards-fysetc:
2+
3+
FYSETC
4+
######
5+
6+
.. toctree::
7+
:maxdepth: 1
8+
:glob:
9+
10+
**/*

boards/fysetc/ucan/Kconfig.ucan

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

boards/fysetc/ucan/board.cmake

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

boards/fysetc/ucan/board.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
board:
2+
name: ucan
3+
full_name: UCAN
4+
vendor: fysetc
5+
socs:
6+
- name: stm32f072xb

boards/fysetc/ucan/doc/index.rst

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
.. zephyr:board:: ucan
2+
3+
Overview
4+
********
5+
6+
The FYSETC UCAN is an open-source USB to CAN 2.0B adapter board. More information can be found on
7+
the `UCAN website`_ and in the `UCAN wiki`_.
8+
9+
Hardware
10+
********
11+
12+
The UCAN board is equipped with a STM32F072CB microcontroller and features an USB-C connector, a
13+
terminal block for connecting to the CAN bus, and two user LEDs. Schematics and component placement
14+
drawings are available in the `UCAN GitHub repository`_.
15+
16+
Supported Features
17+
==================
18+
19+
The ``ucan`` board configuration supports the following hardware features:
20+
21+
+-----------+------------+-------------------------------------+
22+
| Interface | Controller | Driver/Component |
23+
+===========+============+=====================================+
24+
| NVIC | on-chip | nested vector interrupt controller |
25+
+-----------+------------+-------------------------------------+
26+
| PINMUX | on-chip | pinmux |
27+
+-----------+------------+-------------------------------------+
28+
| FLASH | on-chip | flash memory |
29+
+-----------+------------+-------------------------------------+
30+
| GPIO | on-chip | gpio |
31+
+-----------+------------+-------------------------------------+
32+
| USB | on-chip | USB |
33+
+-----------+------------+-------------------------------------+
34+
| CAN1 | on-chip | CAN controller |
35+
+-----------+------------+-------------------------------------+
36+
37+
The default configuration can be found in the defconfig file:
38+
:zephyr_file:`boards/fysetc/ucan/ucan_defconfig`.
39+
40+
Other hardware features are not currently supported by the port.
41+
42+
System Clock
43+
============
44+
45+
The STM32F072CB PLL is driven by an external crystal oscillator (HSE) running at 8 MHz and
46+
configured to provide a system clock of 48 MHz.
47+
48+
Programming and Debugging
49+
*************************
50+
51+
Build and flash applications as usual (see :ref:`build_an_application` and
52+
:ref:`application_run` for more details).
53+
54+
If flashing via USB DFU, short pins ``B0`` and ``3V3`` when applying power to the UCAN board in
55+
order to enter the built-in DFU mode.
56+
57+
Here is an example for the :zephyr:code-sample:`blinky` application.
58+
59+
.. zephyr-app-commands::
60+
:zephyr-app: samples/basic/blinky
61+
:board: ucan
62+
:goals: flash
63+
64+
.. _UCAN website:
65+
https://www.fysetc.com/products/fysetc-ucan-board
66+
67+
.. _UCAN wiki:
68+
https://wiki.fysetc.com/UCAN/
69+
70+
.. _UCAN GitHub repository:
71+
https://github.com/FYSETC/UCAN/

boards/fysetc/ucan/doc/ucan.webp

37.2 KB
Loading

boards/fysetc/ucan/ucan.dts

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
/*
2+
* Copyright (c) 2024 Henrik Brix Andersen <[email protected]>
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
/dts-v1/;
8+
9+
#include <st/f0/stm32f072Xb.dtsi>
10+
#include <st/f0/stm32f072c(8-b)tx-pinctrl.dtsi>
11+
12+
/ {
13+
model = "FYSETC UCAN board";
14+
compatible = "fysetc,ucan";
15+
16+
chosen {
17+
zephyr,sram = &sram0;
18+
zephyr,flash = &flash0;
19+
zephyr,code-partition = &slot0_partition;
20+
zephyr,canbus = &can1;
21+
};
22+
23+
aliases {
24+
led0 = &led_rx;
25+
led1 = &led_tx;
26+
};
27+
28+
leds {
29+
compatible = "gpio-leds";
30+
led_rx: led_rx {
31+
gpios = <&gpioa 0 GPIO_ACTIVE_HIGH>;
32+
label = "LED RX";
33+
};
34+
led_tx: led_tx {
35+
gpios = <&gpioa 1 GPIO_ACTIVE_HIGH>;
36+
label = "LED TX";
37+
};
38+
};
39+
40+
transceiver0: can-phy0 {
41+
compatible = "can-transceiver-gpio";
42+
enable-gpios = <&gpioc 13 GPIO_ACTIVE_LOW>;
43+
max-bitrate = <1000000>;
44+
#phy-cells = <0>;
45+
};
46+
};
47+
48+
&clk_hse {
49+
status = "okay";
50+
clock-frequency = <DT_FREQ_M(8)>;
51+
};
52+
53+
&pll {
54+
prediv = <1>;
55+
mul = <6>;
56+
clocks = <&clk_hse>;
57+
status = "okay";
58+
};
59+
60+
&rcc {
61+
clocks = <&pll>;
62+
clock-frequency = <DT_FREQ_M(48)>;
63+
ahb-prescaler = <1>;
64+
apb1-prescaler = <1>;
65+
};
66+
67+
zephyr_udc0: &usb {
68+
pinctrl-0 = <&usb_dm_pa11 &usb_dp_pa12>;
69+
pinctrl-names = "default";
70+
status = "okay";
71+
};
72+
73+
&can1 {
74+
pinctrl-0 = <&can_rx_pb8 &can_tx_pb9>;
75+
pinctrl-names = "default";
76+
phys = <&transceiver0>;
77+
status = "okay";
78+
};
79+
80+
&flash0 {
81+
partitions {
82+
compatible = "fixed-partitions";
83+
#address-cells = <1>;
84+
#size-cells = <1>;
85+
86+
boot_partition: partition@0 {
87+
label = "mcuboot";
88+
reg = <0x00000000 DT_SIZE_K(48)>;
89+
read-only;
90+
};
91+
slot0_partition: partition@c000 {
92+
label = "image-0";
93+
reg = <0x0000c000 DT_SIZE_K(80)>;
94+
};
95+
};
96+
};

boards/fysetc/ucan/ucan.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
identifier: ucan
2+
name: FYSETC UCAN
3+
type: mcu
4+
arch: arm
5+
toolchain:
6+
- zephyr
7+
- gnuarmemb
8+
ram: 16
9+
flash: 128
10+
supported:
11+
- can
12+
- gpio
13+
- usb_device
14+
- usbd
15+
vendor: fysetc

boards/fysetc/ucan/ucan_defconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CONFIG_GPIO=y

0 commit comments

Comments
 (0)