You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2022/10/19 16:08:48 UTC
[incubator-nuttx] 01/04: stm32f7/nucleo-144: add CAN1 pins selection
This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
commit 0954b60df6f2095ebdc1941c79b505cb8005d183
Author: raiden00pl <ra...@railab.me>
AuthorDate: Tue Oct 18 09:43:59 2022 +0200
stm32f7/nucleo-144: add CAN1 pins selection
---
boards/arm/stm32f7/nucleo-144/Kconfig | 14 ++++++++++++++
boards/arm/stm32f7/nucleo-144/include/board.h | 13 +++++++++----
2 files changed, 23 insertions(+), 4 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 */
-
-#define GPIO_CAN1_TX GPIO_CAN1_TX_3
-#define GPIO_CAN1_RX GPIO_CAN1_RX_3
+/* CAN Bus */
+
+#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 */