Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Kconfig pin config chooser for nucleo-l432kc USARTs. #11

Merged
merged 1 commit into from
Dec 31, 2019
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
102 changes: 102 additions & 0 deletions boards/arm/stm32l4/nucleo-l432kc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,106 @@

if ARCH_BOARD_NUCLEO_L432KC

menu "U[S]ART Pin Layouts"
depends on STM32L4_USART1 || STM32L4_USART2 || STM32L4_LPUART1

comment "USART1 is disabled. (Enable it under: System Type -> STM32L4 Peripheral Support)"
depends on !STM32L4_USART1

choice
depends on STM32L4_USART1
prompt "USART1 RX pin"
default ARCH_BOARD_USART1_RX_PA10
---help---
This pin can be one of the following:
PA10: CN9 pin 3, CN10 pin 33
PB7 : CN7 pin 21

config ARCH_BOARD_USART1_RX_PA10
bool "PA10: CN9 pin 3, CN10 pin 33"

config ARCH_BOARD_USART1_RX_PB7
bool "PB7: CN7 pin 21"

endchoice

choice
depends on STM32L4_USART1
prompt "USART1 TX pin"
default ARCH_BOARD_USART1_TX_PA9
---help---
This pin can be one of the following:
PA9: CN5 pin 1, CN10 pin 21
PB6: CN5 pin 3, CN10 pin 17

config ARCH_BOARD_USART1_TX_PA9
bool "PA9: CN5 pin 1, CN10 pin 21"

config ARCH_BOARD_USART1_TX_PB6
bool "PB6: CN5 pin 3, CN10 pin 17"

endchoice

comment "USART2 is disabled. (Enable it under: System Type -> STM32L4 Peripheral Support)"
depends on !STM32L4_USART2

choice
depends on STM32L4_USART2
prompt "USART2 RX pin"
default ARCH_BOARD_USART2_RX_PA15
---help---
This pin can be one of the following:
PA3
PA15 (connected to ST-Link)

config ARCH_BOARD_USART2_RX_PA3
bool "PA3"

config ARCH_BOARD_USART2_RX_PA15
bool "PA15"

endchoice

choice
depends on STM32L4_USART2
prompt "USART2 TX pin"
default ARCH_BOARD_USART2_TX_PA2
---help---
This pin can only be:
PA2 (connected to ST-Link)

config ARCH_BOARD_USART2_TX_PA2
bool "PA2"

endchoice

comment "LPUART1 is disabled. (Enable it under: System Type -> STM32L4 Peripheral Support)"
depends on !STM32L4_LPUART1

choice
depends on STM32L4_LPUART1
prompt "LPUART1 RX pin"
default ARCH_BOARD_LPUART1_RX_PA3
---help---
This pin can only be PA3.

config ARCH_BOARD_LPUART1_RX_PA3
bool "PA3"

endchoice

choice
depends on STM32L4_LPUART1
prompt "LPUART1 TX pin"
default ARCH_BOARD_LPUART1_TX_PA2
---help---
This pin can only be PA2.

config ARCH_BOARD_LPUART1_TX_PA2
bool "PA2"

endchoice

endmenu

endif # ARCH_BOARD_NUCLEO_L432KC
26 changes: 22 additions & 4 deletions boards/arm/stm32l4/nucleo-l432kc/include/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,21 +85,39 @@
* PB6 CN5 pin 3, CN10 pin 17
*/

#if 1
#if defined(CONFIG_ARCH_BOARD_USART1_RX_PA10)
# define GPIO_USART1_RX GPIO_USART1_RX_1 /* PA10 */
# define GPIO_USART1_TX GPIO_USART1_TX_1 /* PA9 */
#else
#elif defined(CONFIG_ARCH_BOARD_USART1_RX_PB7)
# define GPIO_USART1_RX GPIO_USART1_RX_2 /* PB7 */
#endif

#if defined(CONFIG_ARCH_BOARD_USART1_TX_PA9)
# define GPIO_USART1_TX GPIO_USART1_TX_1 /* PA9 */
#elif defined(CONFIG_ARCH_BOARD_USART1_TX_PB6)
# define GPIO_USART1_TX GPIO_USART1_TX_2 /* PB6 */
#endif

/* USART2: Connected to STLInk Debug via PA2(TX), PA15(RX) */

#define GPIO_USART2_RX GPIO_USART2_RX_2 /* PA15 */
#if defined(CONFIG_ARCH_BOARD_USART2_RX_PA3)
# define GPIO_USART2_RX GPIO_USART2_RX_1 /* PA3 */
#elif defined(CONFIG_ARCH_BOARD_USART2_RX_PA15)
# define GPIO_USART2_RX GPIO_USART2_RX_2 /* PA15 */
#endif
#define GPIO_USART2_TX GPIO_USART2_TX_1 /* PA2 */
#define GPIO_USART2_RTS GPIO_USART2_RTS_2
#define GPIO_USART2_CTS GPIO_USART2_CTS_2

/* LPUART1 */

#if defined(CONFIG_ARCH_BOARD_LPUART1_RX_PA3)
# define GPIO_LPUART1_RX GPIO_LPUART1_RX_1 /* PA3 */
#endif

#if defined(CONFIG_ARCH_BOARD_LPUART1_TX_PA2)
# define GPIO_LPUART1_TX GPIO_LPUART1_TX_1 /* PA2 */
#endif

/* I2C
*
* On Arduino the I2C bus is available at positions A4 and A5. On the
Expand Down