stm32: Add alternate serial ports on stm32f4

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2021-05-24 21:17:51 -04:00
parent c1e8ee58e7
commit 6a3c357a50
2 changed files with 22 additions and 3 deletions

View File

@ -233,18 +233,25 @@ choice
config STM32_SERIAL_USART1_ALT_PA15_PA14 config STM32_SERIAL_USART1_ALT_PA15_PA14
bool "Serial (on USART1 PA15/PA14)" if LOW_LEVEL_OPTIONS && MACH_STM32F0 bool "Serial (on USART1 PA15/PA14)" if LOW_LEVEL_OPTIONS && MACH_STM32F0
select SERIAL select SERIAL
config STM32_SERIAL_USART1_ALT_PB7_PB6
bool "Serial (on USART1 PB7/PB6)" if LOW_LEVEL_OPTIONS && MACH_STM32F4
select SERIAL
config STM32_SERIAL_USART2 config STM32_SERIAL_USART2
bool "Serial (on USART2 PA3/PA2)" if LOW_LEVEL_OPTIONS bool "Serial (on USART2 PA3/PA2)" if LOW_LEVEL_OPTIONS
select SERIAL select SERIAL
config STM32_SERIAL_USART2_ALT_PA15_PA14 config STM32_SERIAL_USART2_ALT_PA15_PA14
bool "Serial (on USART2 PA15/PA14)" if LOW_LEVEL_OPTIONS && MACH_STM32F0 bool "Serial (on USART2 PA15/PA14)" if LOW_LEVEL_OPTIONS && MACH_STM32F0
select SERIAL select SERIAL
config STM32_SERIAL_USART2_ALT_PD6_PD5
bool "Serial (on USART2 PD6/PD5)" if LOW_LEVEL_OPTIONS && MACH_STM32F4
select SERIAL
config STM32_SERIAL_USART3 config STM32_SERIAL_USART3
bool "Serial (on USART3 PB11/PB10)" if LOW_LEVEL_OPTIONS && !MACH_STM32F0 bool "Serial (on USART3 PB11/PB10)" if LOW_LEVEL_OPTIONS
depends on MACH_STM32F405 || MACH_STM32F407 || MACH_STM32F446
select SERIAL select SERIAL
config STM32_SERIAL_USART3_ALT_PD9_PD8 config STM32_SERIAL_USART3_ALT_PD9_PD8
depends on LOW_LEVEL_OPTIONS && (MACH_STM32F405 || MACH_STM32F407) bool "Serial (on USART3 PD9/PD8)" if LOW_LEVEL_OPTIONS
bool "Serial (on USART3 PD9/PD8)" depends on MACH_STM32F405 || MACH_STM32F407 || MACH_STM32F446
select SERIAL select SERIAL
config STM32_CANBUS_PA11_PA12 config STM32_CANBUS_PA11_PA12
bool "CAN bus (on PA11/PA12)" if HAVE_STM32_CANBUS bool "CAN bus (on PA11/PA12)" if HAVE_STM32_CANBUS

View File

@ -18,12 +18,24 @@
#define GPIO_Tx GPIO('A', 9) #define GPIO_Tx GPIO('A', 9)
#define USARTx USART1 #define USARTx USART1
#define USARTx_IRQn USART1_IRQn #define USARTx_IRQn USART1_IRQn
#elif CONFIG_STM32_SERIAL_USART1_ALT_PB7_PB6
DECL_CONSTANT_STR("RESERVE_PINS_serial", "PB7,PB6");
#define GPIO_Rx GPIO('B', 7)
#define GPIO_Tx GPIO('B', 6)
#define USARTx USART1
#define USARTx_IRQn USART1_IRQn
#elif CONFIG_STM32_SERIAL_USART2 #elif CONFIG_STM32_SERIAL_USART2
DECL_CONSTANT_STR("RESERVE_PINS_serial", "PA3,PA2"); DECL_CONSTANT_STR("RESERVE_PINS_serial", "PA3,PA2");
#define GPIO_Rx GPIO('A', 3) #define GPIO_Rx GPIO('A', 3)
#define GPIO_Tx GPIO('A', 2) #define GPIO_Tx GPIO('A', 2)
#define USARTx USART2 #define USARTx USART2
#define USARTx_IRQn USART2_IRQn #define USARTx_IRQn USART2_IRQn
#elif CONFIG_STM32_SERIAL_USART2_ALT_PD6_PD5
DECL_CONSTANT_STR("RESERVE_PINS_serial", "PD6,PD5");
#define GPIO_Rx GPIO('D', 6)
#define GPIO_Tx GPIO('D', 5)
#define USARTx USART2
#define USARTx_IRQn USART2_IRQn
#elif CONFIG_STM32_SERIAL_USART3 #elif CONFIG_STM32_SERIAL_USART3
DECL_CONSTANT_STR("RESERVE_PINS_serial", "PB11,PB10"); DECL_CONSTANT_STR("RESERVE_PINS_serial", "PB11,PB10");
#define GPIO_Rx GPIO('B', 11) #define GPIO_Rx GPIO('B', 11)