aboutsummaryrefslogtreecommitdiffstats
path: root/src/stm32
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2021-05-25 23:03:43 -0400
committerKevin O'Connor <kevin@koconnor.net>2021-05-25 23:50:28 -0400
commitf99dca09181bd3967913ec6f214216f80b8cfae2 (patch)
tree5975319cf67752bfc963aa4082d99eda3d1cbf3c /src/stm32
parent273106358d97ce1c1c9d5c12f3a58666494a9e5c (diff)
downloadkutter-f99dca09181bd3967913ec6f214216f80b8cfae2.tar.gz
kutter-f99dca09181bd3967913ec6f214216f80b8cfae2.tar.xz
kutter-f99dca09181bd3967913ec6f214216f80b8cfae2.zip
stm32: Allow alternate USART1 and USART2 ports on stm32f1 and stm32f2
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src/stm32')
-rw-r--r--src/stm32/Kconfig4
-rw-r--r--src/stm32/stm32f1.c8
2 files changed, 9 insertions, 3 deletions
diff --git a/src/stm32/Kconfig b/src/stm32/Kconfig
index 16fe9044..90ba6523 100644
--- a/src/stm32/Kconfig
+++ b/src/stm32/Kconfig
@@ -234,7 +234,7 @@ choice
bool "Serial (on USART1 PA15/PA14)" if LOW_LEVEL_OPTIONS && MACH_STM32F0
select SERIAL
config STM32_SERIAL_USART1_ALT_PB7_PB6
- bool "Serial (on USART1 PB7/PB6)" if LOW_LEVEL_OPTIONS && MACH_STM32F4
+ bool "Serial (on USART1 PB7/PB6)" if LOW_LEVEL_OPTIONS && !MACH_STM32F0
select SERIAL
config STM32_SERIAL_USART2
bool "Serial (on USART2 PA3/PA2)" if LOW_LEVEL_OPTIONS
@@ -243,7 +243,7 @@ choice
bool "Serial (on USART2 PA15/PA14)" if LOW_LEVEL_OPTIONS && MACH_STM32F0
select SERIAL
config STM32_SERIAL_USART2_ALT_PD6_PD5
- bool "Serial (on USART2 PD6/PD5)" if LOW_LEVEL_OPTIONS && MACH_STM32F4
+ bool "Serial (on USART2 PD6/PD5)" if LOW_LEVEL_OPTIONS && !MACH_STM32F0
select SERIAL
config STM32_SERIAL_USART3
bool "Serial (on USART3 PB11/PB10)" if LOW_LEVEL_OPTIONS
diff --git a/src/stm32/stm32f1.c b/src/stm32/stm32f1.c
index b9c1a434..57007615 100644
--- a/src/stm32/stm32f1.c
+++ b/src/stm32/stm32f1.c
@@ -156,7 +156,13 @@ gpio_peripheral(uint32_t gpio, uint32_t mode, int pullup)
AFIO_MAPR_I2C1_REMAP);
} else if (func == 7) {
// USART
- if (gpio == GPIO('D', 8) || gpio == GPIO('D', 9))
+ if (gpio == GPIO('B', 6) || gpio == GPIO('B', 7))
+ stm32f1_alternative_remap(AFIO_MAPR_USART1_REMAP_Msk,
+ AFIO_MAPR_USART1_REMAP);
+ else if (gpio == GPIO('D', 5) || gpio == GPIO('D', 6))
+ stm32f1_alternative_remap(AFIO_MAPR_USART2_REMAP_Msk,
+ AFIO_MAPR_USART2_REMAP);
+ else if (gpio == GPIO('D', 8) || gpio == GPIO('D', 9))
stm32f1_alternative_remap(AFIO_MAPR_USART3_REMAP_Msk,
AFIO_MAPR_USART3_REMAP_FULLREMAP);
} else if (func == 9) {