Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions boards/arm/nucleo_g474re/nucleo_g474re.dts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
zephyr,shell-uart = &lpuart1;
zephyr,sram = &sram0;
zephyr,flash = &flash0;
zephyr,can-primary = &can1;
};

leds {
Expand Down Expand Up @@ -153,3 +154,14 @@
pinctrl-0 = <&adc1_in1_pa0>;
status = "okay";
};

&can1 {
pinctrl-0 = <&fdcan1_rx_pa11 &fdcan1_tx_pa12>;
bus-speed = <125000>;
sjw = <1>;
sample-point = <875>;
bus-speed-data = <1000000>;
sjw-data = <1>;
sample-point-data = <875>;
status = "okay";
};
2 changes: 2 additions & 0 deletions boards/arm/nucleo_g474re/nucleo_g474re.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,5 @@ supported:
- watchdog
- adc
- dma
- can
- canfd
2 changes: 2 additions & 0 deletions drivers/can/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ zephyr_sources_ifdef(CONFIG_CAN can_common.c)
zephyr_sources_ifdef(CONFIG_CAN_LOOPBACK can_loopback.c)
zephyr_sources_ifdef(CONFIG_CAN_MCP2515 can_mcp2515.c)
zephyr_sources_ifdef(CONFIG_CAN_STM32 can_stm32.c)
zephyr_sources_ifdef(CONFIG_CAN_STM32FD can_stm32fd.c)
zephyr_sources_ifdef(CONFIG_CAN_MCAN can_mcan.c)
zephyr_sources_ifdef(CONFIG_CAN_MCUX_FLEXCAN can_mcux_flexcan.c)

zephyr_sources_ifdef(CONFIG_USERSPACE can_handlers.c)
Expand Down
25 changes: 23 additions & 2 deletions drivers/can/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,30 @@ config CAN_SHELL
help
Enable CAN Shell for testing.

config CAN_FD_MODE
config CAN_HAS_CANFD
bool
help
driver supports CAN-FD

config CAN_FD_MODE
bool "CAN-FD"
default y
depends on CAN_HAS_CANFD
help
Enable CAN-FD compatible API

if CAN_FD_MODE

config CANFD_MAX_DLC
int "Max data length code in CAN frames"
range 8 15
default 15
help
Maximum allowed DLC in a CAN frame. This parameter sets the
data buffer size in a CAN frame and is therefore only used to
optimize memory consumption.
endif # CAN_FD_MODE

config CAN_INIT_PRIORITY
int "CAN driver init priority"
default 80
Expand All @@ -47,7 +66,7 @@ config CAN_WORKQ_FRAMES_BUF_CNT

config CAN_RX_TIMESTAMP
bool "Enable receiving timestamps"
depends on CAN_STM32 || CAN_MCUX_FLEXCAN
depends on CAN_STM32 || CAN_MCUX_FLEXCAN || CAN_STM32FD
help
This option enables a timestamp value of the CAN free running timer.
The value is incremented every bit time and starts when the controller
Expand All @@ -63,8 +82,10 @@ config CAN_AUTO_BUS_OFF_RECOVERY
available.

source "drivers/can/Kconfig.stm32"
source "drivers/can/Kconfig.stm32fd"
source "drivers/can/Kconfig.mcux"
source "drivers/can/Kconfig.mcp2515"
source "drivers/can/Kconfig.mcan"
source "drivers/can/Kconfig.loopback"
source "drivers/can/Kconfig.net"

Expand Down
22 changes: 22 additions & 0 deletions drivers/can/Kconfig.mcan
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Bosch m_can configuration options

# Copyright (c) 2020 Alexander Wachter
# SPDX-License-Identifier: Apache-2.0

config CAN_MCAN
bool
select CAN_HAS_CANFD
help
Enable Bosch m_can driver.
This driver supports the Bosch m_can IP. This IP is built into the
STM32G4, STM32G0 and the Microchip SAM controllers with CAN-FD.

if CAN_MCAN

config CAN_DELAY_COMP
bool "Enable transceiver delay compensation"
default y
help
Enable the automatic transceiver delay compensation.

endif #CAN_MCAN
42 changes: 42 additions & 0 deletions drivers/can/Kconfig.stm32fd
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# STM32 CAN configuration options

# Copyright (c) 2020 Alexander Wachter
# SPDX-License-Identifier: Apache-2.0

DT_COMPAT_STM32_FDCAN := st,stm32-fdcan

config CAN_STM32FD
bool "STM32 FDCAN driver"
default $(dt_compat_enabled,$(DT_COMPAT_STM32_FDCAN))
select CAN_MCAN
select USE_STM32_LL_RCC

if CAN_STM32FD

config CAN_MAX_STD_ID_FILTER
int "Maximum number of std ID filters"
default 28
range 0 28
help
Defines the maximum number of filters with standard ID (11-bit)
that can be attached.

config CAN_MAX_EXT_ID_FILTER
int "Maximum number of ext ID filters"
default 8
range 0 8
help
Defines the maximum number of filters with extended ID (29-bit)
that can be attached.

config CAN_STM32_CLOCK_DIVISOR
int "CAN clock divisor"
range 1 30
default 1
help
The APB clock is divided by this value (stored in CKDIV register)
before it is fed to the CAN core.
Note that the the divisor affects all CAN controllers.
Allowed values: 1 or 2 * n, where n <= 15.

endif #CAN_STM32FD
Loading