新手请教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条回答
CZM陈先生123
1楼-- · 2019-07-14 19:16
同问
maruidiyi
2楼-- · 2019-07-14 21:49
 精彩回答 2  元偷偷看……
CZM陈先生123
3楼-- · 2019-07-15 03:36
需要怎么配置,我只是在IO配置写了
       
  /* Configure PF.0  as PP output */
  GPIO_InitStruct.GPIO_Pin = GPIO_Pin_0;
  GPIO_InitStruct.GPIO_Mode = GPIO_Mode_OUT;
  GPIO_InitStruct.GPIO_OType = GPIO_OType_PP;
  GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz;
  GPIO_Init(GPIOF, &GPIO_InitStruct);
TOPCB
4楼-- · 2019-07-15 04:57
看一下GPIO.h,里面有IO复用映射void GPIO_PinAFConfig(GPIO_TypeDef* GPIOx, uint16_t GPIO_PinSource, uint8_t GPIO_AF);
lan23
5楼-- · 2019-07-15 06:33
回复第 5 楼 于2014-03-28 14:46:03发表:
看一下GPIO.h,里面有IO复用映射void GPIO_PinAFConfig(GPIO_TypeDef* GPIOx, uint16_t GPIO_PinSource, uint8_t GPIO_AF); 

我试过: //GPIO_PinAFConfig(GPIOF, GPIO_PinSource1, GPIO_AF_0);
发现不好使,F030的PDF中只描述了GPIOA,GPIOB的AFn的复用,没有讲到GPIOF,不知道怎么设置
lan23
6楼-- · 2019-07-15 06:51
回复第 7 楼 于2014-03-29 10:06:02发表:
我看了一下手册,应该是直接用就可以了。这2个引脚没有复用。 

没有选择内部振荡器,结果管脚对地大约1.8V左右,选择内部RC振荡器后,管脚始终是低电平,f0的资料也太少了,要是f1早就搞定了

一周热门 更多>