diff --git a/bsp/stm32f107/drivers/rt_stm32f10x_spi.c b/bsp/stm32f107/drivers/rt_stm32f10x_spi.c index 124c41945b..08d24c75eb 100644 --- a/bsp/stm32f107/drivers/rt_stm32f10x_spi.c +++ b/bsp/stm32f107/drivers/rt_stm32f10x_spi.c @@ -419,8 +419,9 @@ rt_err_t stm32_spi_register(SPI_TypeDef * SPI, { rt_err_t res = RT_EOK; NVIC_InitTypeDef NVIC_InitStructure; - RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO, ENABLE); rt_uint32_t flags = 0; + RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO, ENABLE); + if(SPI == SPI1) { stm32_spi->SPI = SPI1;