The clock set difference between stm32f030 and stm32f072.

所属分类:STM32F系列 浏览数:88 提问者: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

登录后回答。
图书推荐
ARM快速嵌入式系统原型设计

ARM快速嵌入式系统原型设计

本书通过mbed介绍嵌入式系统设计的所有主要议题,便于读者快速掌握嵌入式系统的设计方法。
STM32库开发实战指南

STM32库开发实战指南

本书围绕库的分析和使用,对综合运用固件库开发项目给出了具体范例,循序渐进、系统地掌握。
轻松玩转STM32Cube

轻松玩转STM32Cube

本书结合官方手册和例程,全面、系统介绍了STM32F103各项功能,是学习STM32的入门教材。
广告