The clock set difference between stm32f030 and stm32f072.

所属分类:STM32F系列 浏览数:301 提问者:hellonsn 提问时间:2018-01-08
标签:STM32F0

问:

the same code attempts to configure stm32f072R8 board failed , but it works on stm32f030 , so what's the clock configuration difference between these two boards?


答:how do assure that it's because of clock configuration difference? maybe you can use a simple GPIO to flash a led to verify the hardware first, and you no need do any clock configuration maunally. of course the RCCs of the both exist difference, you can refer to the corresponding reference manuals for the detail.
回答者:xmshao 回答时间:2018-01-08

答:I am using the stm32f072-discovery board , and try to port the NUTTX system on it. The first stage is to configure the system clock , and then I tried to use GPIO to turn on a led on this board. but seems it failed. but the same clock configuration code works well on stm32f030-discovery and the led can be on after that. So I suspect the clock configuration is not configured in a proper way.
回答者:hellonsn 回答时间:2018-01-09

答:void stm32f0_clockconfig(void) { uint32_t regval; /* Verify if PLL is already setup. If so configure to use HSI mode */ if ((getreg32(STM32F0_RCC_CFGR) & RCC_CFGR_SWS_MASK) == RCC_CFGR_SWS_PLL) { /* Select HSI mode */ regval = getreg32(STM32F0_RCC_CFGR); regval &= ~RCC_CFGR_SW_MASK; putreg32(regval, STM32F0_RCC_CFGR); while ((getreg32(STM32F0_RCC_CFGR) & RCC_CFGR_SWS_MASK) != RCC_CFGR_SWS_HSI); } /* Disable the PLL */ regval = getreg32(STM32F0_RCC_CR); regval &= ~RCC_CR_PLLON; putreg32(regval, STM32F0_RCC_CR); while ((getreg32(STM32F0_RCC_CR) & RCC_CR_PLLRDY) != 0); /* Enable FLASH prefetch buffer and set flash latency */ regval = getreg32(STM32_FLASH_ACR); regval &= ~FLASH_ACR_LATENCY_MASK; regval |= (FLASH_ACR_LATENCY_1 | FLASH_ACR_PRTFBE); putreg32(regval, STM32_FLASH_ACR); /* Set HCLK = SYSCLK */ regval = getreg32(STM32F0_RCC_CFGR); regval &= ~RCC_CFGR_HPRE_MASK;
回答者:hellonsn 回答时间:2018-01-09

答:there are losts of examples in STM32cubef0 firmware package, you can download it from www.st.com. maybe you can firstly use those existing example routines.
回答者:xmshao 回答时间:2018-01-09

登录后回答。
图书推荐
漫画半导体(高清版)

漫画半导体(高清版)

这是一本实用性很强的图书,,以漫画的形式更易于让人接受,边读故事边学知识,轻松且易于记忆。
算法心得:高效算法的奥秘

算法心得:高效算法的奥秘

本书给我们带来了一大批极为诱人的知识,其中包括各种节省程序运行时间的技巧、算法与窍门...
基于STM8S-无刷直流电机控制应用

基于STM8S-无刷直流电机控制应用

无刷直流电机是21世纪最有发展前景的新型电机之一。本书以STM8S单片机为控制核心...
广告