Skip to content

Commit b04011a

Browse files
committed
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.
1 parent 626c350 commit b04011a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

hw/mcu/stm/stm32_common/src/hal_spi.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -648,7 +648,9 @@ hal_spi_config(int spi_num, struct hal_spi_settings *settings)
648648
#if SPI_4_ENABLED
649649
case 4:
650650
__HAL_RCC_SPI5_CLK_ENABLE();
651-
#if !MYNEWT_VAL(MCU_STM32F1)
651+
#if defined(GPIO_AF6_SPI5)
652+
gpio.Alternate = GPIO_AF6_SPI5;
653+
#elif defined(GPIO_AF5_SPI5)
652654
gpio.Alternate = GPIO_AF5_SPI5;
653655
#endif
654656
spi->handle.Instance = SPI5;

0 commit comments

Comments
 (0)