apachectl 发表于 2014-3-27 22:39:06

新手请教STM32f030的PF0的问题

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 还是不能用,有哪位大虾知道否?

tengchao998-258 发表于 2014-7-5 14:09:56

回复:新手请教STM32f030的PF0的问题

在System_stm32F030xx.c文件中,
将static void SetSysClock(void) 函数中的
RCC->CR  = (uint32_t)RCC_CR_HSEON;
改为:
RCC->CR &= ~((uint32_t)RCC_CR_HSEON);
也就是将外部时钟关闭就行了

发表于 2014-3-29 10:06:02

RE:新手请教STM32f030的PF0的问题

我看了一下手册,应该是直接用就可以了。这2个引脚没有复用。

tbbttbbt 发表于 2014-3-28 09:26:45

RE:新手请教STM32f030的PF0的问题

同问;P

fengye5340 发表于 2014-3-28 09:33:38

RE:新手请教STM32f030的PF0的问题

你的OSC_IN/OSC_OUT 引脚用作GPIO时需要配置,也就是进行端口映射,默认是晶振管脚,不知道你配置了吗?

tbbttbbt 发表于 2014-3-28 09:44:33

RE:新手请教STM32f030的PF0的问题

需要怎么配置,我只是在IO配置写了
       
/* Configure PF.0as 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);

发表于 2014-3-28 14:46:03

RE:新手请教STM32f030的PF0的问题

看一下GPIO.h,里面有IO复用映射void GPIO_PinAFConfig(GPIO_TypeDef* GPIOx, uint16_t GPIO_PinSource, uint8_t GPIO_AF);

apachectl 发表于 2014-3-28 22:05:47

回复:新手请教STM32f030的PF0的问题

回复第 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,不知道怎么设置

apachectl 发表于 2014-3-29 16:15:29

回复:新手请教STM32f030的PF0的问题

回复第 7 楼 于2014-03-29 10:06:02发表:
我看了一下手册,应该是直接用就可以了。这2个引脚没有复用。 

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

thomas 发表于 2014-3-30 00:09:05

回复:新手请教STM32f030的PF0的问题

stm32的芯片在哪能找到datasheet?各种芯片资料上EasyDatasheet可以查到

有缘于你 发表于 2014-4-1 20:32:16

RE:新手请教STM32f030的PF0的问题

RCC_CSR 中的HSEON 和LSEON 直接清零呢
页: [1] 2 3
查看完整版本: 新手请教STM32f030的PF0的问题