From 0954b60df6f2095ebdc1941c79b505cb8005d183 Mon Sep 17 00:00:00 2001 From: raiden00pl Date: Tue, 18 Oct 2022 09:43:59 +0200 Subject: [PATCH] stm32f7/nucleo-144: add CAN1 pins selection --- boards/arm/stm32f7/nucleo-144/Kconfig | 14 ++++++++++++++ boards/arm/stm32f7/nucleo-144/include/board.h | 11 ++++++++--- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/boards/arm/stm32f7/nucleo-144/Kconfig b/boards/arm/stm32f7/nucleo-144/Kconfig index 81288711f6..1787f12651 100644 --- a/boards/arm/stm32f7/nucleo-144/Kconfig +++ b/boards/arm/stm32f7/nucleo-144/Kconfig @@ -259,4 +259,18 @@ endchoice # "SPI BUS 3 Clock Mode" endif # NUCLEO_SPI3_TEST endif # NUCLEO_SPI_TEST + +choice + prompt "CAN1 pins selection" + default NUCLEO_CAN1_MAP_PD0PD1 + depends on STM32F7_CAN1 + +config NUCLEO_144_CAN1_MAP_D14D15 + bool "CAN1_TX=D14 CAN1_RX=D15" + +config NUCLEO_CAN1_MAP_PD0PD1 + bool "CAN1_RX=PD0 CAN1_TX=PD1" + +endchoice # CAN1 pins selection + endif # ARCH_BOARD_NUCLEO_144 diff --git a/boards/arm/stm32f7/nucleo-144/include/board.h b/boards/arm/stm32f7/nucleo-144/include/board.h index e7c15d7ae0..e7cd488f17 100644 --- a/boards/arm/stm32f7/nucleo-144/include/board.h +++ b/boards/arm/stm32f7/nucleo-144/include/board.h @@ -505,9 +505,14 @@ #define GPIO_ETH_RMII_TXD0 GPIO_ETH_RMII_TXD0_2 #define GPIO_ETH_RMII_TXD1 GPIO_ETH_RMII_TXD1_1 -/* CAN Bus: CAN1 on pin PD0/PD1 */ +/* CAN Bus */ -#define GPIO_CAN1_TX GPIO_CAN1_TX_3 -#define GPIO_CAN1_RX GPIO_CAN1_RX_3 +#ifdef CONFIG_NUCLEO_CAN1_MAP_PD0PD1 +# define GPIO_CAN1_TX GPIO_CAN1_TX_3 /* PD1 */ +# define GPIO_CAN1_RX GPIO_CAN1_RX_3 /* PD0 */ +#elif CONFIG_NUCLEO_144_CAN1_MAP_D14D15 +# define GPIO_CAN1_TX GPIO_CAN1_TX_2 /* PB9 */ +# define GPIO_CAN1_RX GPIO_CAN1_RX_2 /* PB8 */ +#endif #endif /* __BOARDS_ARM_STM32F7_NUCLEO_144_INCLUDE_BOARD_H */