Skip to content

Commit

Permalink
Merge pull request #6877 from steffen-p/stm32_clk_init_hse_i2c
Browse files Browse the repository at this point in the history
cpu/stm32f3: fix for non-functional i2c
  • Loading branch information
aabadie committed Apr 14, 2017
2 parents 19c4fac + c7e334d commit 3e0edad
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions cpu/stm32f3/cpu.c
Expand Up @@ -140,5 +140,15 @@ static void cpu_clock_init(void)
/* disable the HSI if we use the HSE */
RCC->CR &= ~(RCC_CR_HSION);
while (RCC->CR & RCC_CR_HSIRDY) {}

/* swith I2Cx clock source to SYSCLK */
RCC->CFGR3 &= ~(RCC_CFGR3_I2CSW);
RCC->CFGR3 |= RCC_CFGR3_I2C1SW_SYSCLK;
#ifdef RCC_CFGR3_I2C2SW_SYSCLK
RCC->CFGR3 |= RCC_CFGR3_I2C2SW_SYSCLK;
#endif
#ifdef RCC_CFGR3_I2C3SW_SYSCLK
RCC->CFGR3 |= RCC_CFGR3_I2C3SW_SYSCLK;
#endif
#endif
}

0 comments on commit 3e0edad

Please sign in to comment.