From f99dca09181bd3967913ec6f214216f80b8cfae2 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Tue, 25 May 2021 23:03:43 -0400 Subject: stm32: Allow alternate USART1 and USART2 ports on stm32f1 and stm32f2 Signed-off-by: Kevin O'Connor --- src/stm32/stm32f1.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/stm32/stm32f1.c') 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) { -- cgit v1.2.3-70-g09d2