新手请教STM32f030的PF0的问题

2019-07-14 13:17发布

STM32f030F4  20脚的MCU,GPIO不够,因此想把当晶振用的PF0 和PF1 也用了
看文档写的:
Using the HSE or LSE oscillator pins as GPIOs
When the HSE or LSE oscillator is switched OFF (default state after reset), the related oscillator pins can be used as normal GPIOs.
When the HSE or LSE oscillator is switched ON (by setting the HSEON or LSEON bit in the RCC_CSR register) the oscillator takes control of its associated pins and the GPIO configuration of these pins has no effect.
When the oscillator is configured in a user external clock mode, only the OSC_IN or OSC32_IN pin is reserved for clock input and the OSC_OUT or OSC32_OUT pin can still be used as normal GPIO.

已经:
#define PLL_SOURCE_HSI        // HSI (~8MHz) used to clock the PLL, and the PLL is used as system clock source
//#define PLL_SOURCE_HSE        // HSE (8MHz) used to clock the PLL, and the PLL is used as system clock source
//#define PLL_SOURCE_HSE_BYPASS // HSE bypassed with an external clock (8MHz, coming from ST-Link) used to clock

选择为内部RC振荡器,但是PF0 还是不能用,有哪位大虾知道否?
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
该问题目前已经被作者或者管理员关闭, 无法添加新回复
18条回答
爱雪爱雪
1楼-- · 2019-07-16 05:32
管脚应该是要映射或者配置一下吧
qq97594051
2楼-- · 2019-07-16 08:11
我想问一下怎么样重映射,新手,不太懂~
东莞吉创
3楼-- · 2019-07-16 09:52
在System_stm32F030xx.c文件中,
将static void SetSysClock(void) 函数中的
RCC->CR  = (uint32_t)RCC_CR_HSEON;
改为:
RCC->CR &= ~((uint32_t)RCC_CR_HSEON);
也就是将外部时钟关闭就行了
wang21cj
4楼-- · 2019-07-16 15:08
我也遇到这个问题
hjh22678
5楼-- · 2019-07-16 20:47
 精彩回答 2  元偷偷看……
预言者J
6楼-- · 2019-07-17 00:09
17楼正解!
要用PF0和PF1只要把外部低速时钟关闭,然后配置这两个引脚为GPIO模式就可以了

一周热门 更多>