打印
[STM32F0]

新手请教STM32f030的PF0的问题

[复制链接]
179|13
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
laocuo1142|  楼主 | 2024-1-18 14:29 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
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 还是不能用,有哪位大虾知道否?

使用特权

评论回复
沙发
ex7s4| | 2024-2-22 14:03 | 只看该作者
你都用F0了,可以用cubemx来配置的

使用特权

评论回复
板凳
b5z1giu| | 2024-2-22 15:09 | 只看该作者
你就直接给初始化应该就行吧

使用特权

评论回复
地板
y1n9an| | 2024-2-22 16:25 | 只看该作者
你得先把时钟配置好,然后再初始化好PF0和1估计就行

使用特权

评论回复
5
q1d0mnx| | 2024-2-22 17:31 | 只看该作者
你仿真看看工作流程?

使用特权

评论回复
6
麻花油条| | 2024-2-22 18:00 | 只看该作者
你应该检查启动文件和初始化代码,确保HSE和LSE在需要的时候是被关闭的。

使用特权

评论回复
7
kaif2n9j| | 2024-2-22 19:10 | 只看该作者
确认晶振是否可以被禁用:有些 MCU 允许用户在软件中禁用晶振,从而释放晶振引脚用作 GPIO

使用特权

评论回复
8
p0gon9y| | 2024-2-22 20:17 | 只看该作者
查阅 MCU 的数据手册,确认晶振引脚是否可以被重新配置为 GPIO

使用特权

评论回复
9
onlycook| | 2024-2-22 22:03 | 只看该作者
PF0和PF1引脚有没有损坏

使用特权

评论回复
10
w2nme1ai7| | 2024-2-22 22:36 | 只看该作者
如果晶振被禁用,MCU 的时钟源需要重新配置,确保系统时钟的稳定性和准确性

使用特权

评论回复
11
豌豆爹| | 2024-2-23 08:00 | 只看该作者
如果你使用的是STM的HAL库或标准外设库,可能需要调用特定的函数来关闭HSE或LSE,并将PF0和PF1配置为GPIO。

使用特权

评论回复
12
zhizia4f| | 2024-2-23 08:30 | 只看该作者
如果 MCU 支持在软件中禁用晶振,可以通过相应的寄存器设置来实现

使用特权

评论回复
13
d1ng2x| | 2024-2-23 10:20 | 只看该作者
将晶振引脚重新配置为 GPIO 引脚,可以通过相应的寄存器设置或者库函数来实现

使用特权

评论回复
14
liu96jp| | 2024-2-23 12:35 | 只看该作者
如果禁用了晶振,需要重新配置 MCU 的时钟源,确保系统时钟的稳定性和准确性

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

980

主题

4028

帖子

10

粉丝