aboutsummaryrefslogtreecommitdiffstats
path: root/src/stm32
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2021-05-25 22:13:09 -0400
committerKevin O'Connor <kevin@koconnor.net>2021-05-25 22:13:09 -0400
commit12acb99a38a24c239beba952fd0053d952fc19d1 (patch)
treefb8584dae912fbe3360cf3d8be61114468e6d2b4 /src/stm32
parent20a6c6b22529e3ac5c329cb408c735d7fe74c06b (diff)
downloadkutter-12acb99a38a24c239beba952fd0053d952fc19d1.tar.gz
kutter-12acb99a38a24c239beba952fd0053d952fc19d1.tar.xz
kutter-12acb99a38a24c239beba952fd0053d952fc19d1.zip
stm32: Fix USART3 on stm32f1 and stm32f2
Commit 6a3c357a incorrectly disabled support for USART3 on stm32f1 and stm32f2 - restore that support. Also, add support for USART3 on PD9/PD8 on stm32f103. 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.c4
2 files changed, 6 insertions, 2 deletions
diff --git a/src/stm32/Kconfig b/src/stm32/Kconfig
index cdd4527f..16fe9044 100644
--- a/src/stm32/Kconfig
+++ b/src/stm32/Kconfig
@@ -247,11 +247,11 @@ choice
select SERIAL
config STM32_SERIAL_USART3
bool "Serial (on USART3 PB11/PB10)" if LOW_LEVEL_OPTIONS
- depends on MACH_STM32F405 || MACH_STM32F407 || MACH_STM32F446
+ depends on !MACH_STM32F0 && !MACH_STM32F401
select SERIAL
config STM32_SERIAL_USART3_ALT_PD9_PD8
bool "Serial (on USART3 PD9/PD8)" if LOW_LEVEL_OPTIONS
- depends on MACH_STM32F405 || MACH_STM32F407 || MACH_STM32F446
+ depends on !MACH_STM32F0 && !MACH_STM32F401
select SERIAL
config STM32_CANBUS_PA11_PA12
bool "CAN bus (on PA11/PA12)" if HAVE_STM32_CANBUS
diff --git a/src/stm32/stm32f1.c b/src/stm32/stm32f1.c
index 34c28573..86a5efac 100644
--- a/src/stm32/stm32f1.c
+++ b/src/stm32/stm32f1.c
@@ -160,6 +160,10 @@ gpio_peripheral(uint32_t gpio, uint32_t mode, int pullup)
// TIM3 full remap
stm32f1_alternative_remap(AFIO_MAPR_TIM3_REMAP_FULLREMAP_Msk,
AFIO_MAPR_TIM3_REMAP_FULLREMAP);
+ } else if ((gpio == GPIO('D', 8) || gpio == GPIO('D', 9)) && func == 7) {
+ // USART3 remap
+ stm32f1_alternative_remap(AFIO_MAPR_USART3_REMAP_FULLREMAP_Msk,
+ AFIO_MAPR_USART3_REMAP_FULLREMAP);
} else if ((gpio == GPIO('D', 12)
|| gpio == GPIO('D', 13)
|| gpio == GPIO('D', 14)