From 71f6c636d73e218baa2c5f8dc5057f54029132ea Mon Sep 17 00:00:00 2001 From: "Pavel V. Shatov (Meister)" Date: Mon, 13 Sep 2021 11:45:09 +0300 Subject: Initialize I/O pins of SPI3, which is used to configure iCE40-based MKM. Note, that SPI3 is alternate function 6, unlike SPI1 & SPI2 which are both AF5. --- .../TARGET_CRYPTECH_ALPHA/stm32f4xx_hal_msp.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'libraries/mbed/targets/cmsis/TARGET_STM/TARGET_STM32F4') diff --git a/libraries/mbed/targets/cmsis/TARGET_STM/TARGET_STM32F4/TARGET_CRYPTECH_ALPHA/stm32f4xx_hal_msp.c b/libraries/mbed/targets/cmsis/TARGET_STM/TARGET_STM32F4/TARGET_CRYPTECH_ALPHA/stm32f4xx_hal_msp.c index f64e6ce..6983c70 100644 --- a/libraries/mbed/targets/cmsis/TARGET_STM/TARGET_STM32F4/TARGET_CRYPTECH_ALPHA/stm32f4xx_hal_msp.c +++ b/libraries/mbed/targets/cmsis/TARGET_STM/TARGET_STM32F4/TARGET_CRYPTECH_ALPHA/stm32f4xx_hal_msp.c @@ -295,6 +295,24 @@ void HAL_SPI_MspInit(SPI_HandleTypeDef* hspi) /* Peripheral clock enable */ __SPI2_CLK_ENABLE(); + } else if (hspi->Instance == SPI3) { + /* SPI3 is the iCE40 MKM slave config interface + * + * SPI3 GPIO Configuration + * PC10 ------> SPI3_SCK + * PC11 ------> SPI3_MISO + * PC12 ------> SPI3_MOSI + */ + __GPIOC_CLK_ENABLE(); + GPIO_InitStruct.Pin = GPIO_PIN_10 | GPIO_PIN_11 | GPIO_PIN_12; + GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; + GPIO_InitStruct.Pull = GPIO_NOPULL; + GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; + GPIO_InitStruct.Alternate = GPIO_AF6_SPI3; + HAL_GPIO_Init(GPIOC, &GPIO_InitStruct); + + /* Peripheral clock enable */ + __SPI3_CLK_ENABLE(); } } -- cgit v1.2.3