The clock set difference between stm32f030 and stm32f072.

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

登录后回答。
图书推荐
Beginning STM32: Developing with FreeRTOS, libopencm3 and GCC

Beginning STM32: Developing with FreeRTOS, libopencm3 and GCC

Using FreeRTOS and libopencm3 instead of the Arduino software environment, ...
Programming With STM32 : Getting Started With the Nucleo Board

Programming With STM32 : Getting Started With the Nucleo Board

Get up and running programming the STM32 line using the hands-on information ...
野火:RT-Thread内核实现与应用开发实战指南

野火:RT-Thread内核实现与应用开发实战指南

第一部分“从0到1写RT-Thread内核”重点讲解RT-Thread的原理实现;第二部分“RTT内核...
广告