You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by je...@apache.org on 2020/10/28 07:06:47 UTC

[mynewt-core] branch master updated: stm32/hal_spi: Fix alternate function spec for SPI_4

This is an automated email from the ASF dual-hosted git repository.

jerzy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git


The following commit(s) were added to refs/heads/master by this push:
     new b04011a  stm32/hal_spi: Fix alternate function spec for SPI_4
b04011a is described below

commit b04011a368c65593960d3848bc40dd86b920d38a
Author: Jerzy Kasenberg <je...@codecoup.pl>
AuthorDate: Fri Oct 23 13:23:01 2020 +0200

    stm32/hal_spi: Fix alternate function spec for SPI_4
    
    SPI_4 maps to STM SPI5.
    Alternate function for this block is not always GPIO_AF5_SPI5.
    For some MCUs (STM32F411) it should be GPIO_AF6_SPI5.
    So now one that is defined by STM HAL will be used.
---
 hw/mcu/stm/stm32_common/src/hal_spi.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/hw/mcu/stm/stm32_common/src/hal_spi.c b/hw/mcu/stm/stm32_common/src/hal_spi.c
index e8abbda..636cde0 100644
--- a/hw/mcu/stm/stm32_common/src/hal_spi.c
+++ b/hw/mcu/stm/stm32_common/src/hal_spi.c
@@ -648,7 +648,9 @@ hal_spi_config(int spi_num, struct hal_spi_settings *settings)
 #if SPI_4_ENABLED
     case 4:
         __HAL_RCC_SPI5_CLK_ENABLE();
-#if !MYNEWT_VAL(MCU_STM32F1)
+#if defined(GPIO_AF6_SPI5)
+        gpio.Alternate = GPIO_AF6_SPI5;
+#elif defined(GPIO_AF5_SPI5)
         gpio.Alternate = GPIO_AF5_SPI5;
 #endif
         spi->handle.Instance = SPI5;