当前位置:网站首页>STM32F103 几个特殊引脚做普通io使用注意事项以及备份寄存器丢失数据问题1,2
STM32F103 几个特殊引脚做普通io使用注意事项以及备份寄存器丢失数据问题1,2
2022-07-28 11:40:00 【yi_tianchou】
stm32F103C8T6芯片
备份寄存器数据丢失两种可能:
1、触发了入侵中断
PC13 做为普通IO使用时 要禁用入侵中断功能,否则会导致备份寄存器数据在关机,在启动的时候数据丢失,(可以查阅其他文章,不详解)
2、 芯片VBAT 在关机的时候掉电. 如果需要备份寄存器在关机的时候保存数据,那么VBAT需要接到纽扣电池,如果关机之后VBAT也掉电,备份寄存器是无法保存的,当时我就是好奇为什么备份寄存器数据总是丢失,之后发现是VBAT的原因,后来改成了 flash存储的数据,做法:关机的时候触发 低电压中断,然后保存数据到flash.(一般用MCU内部的flash 存储的话,100uF 足够512字节存储)
下面是几个特殊引脚的说明:
1、PC13 RTC
入侵功能介绍:
侵入检测功能分析:功能数据备份。
1 BKP_CR的TPAL位,设定决定TAMPER引脚的信号由0变1或是又1变0为有效触发信号,产生侵入检测事件置位标志 位(BKR_CSR 的TEF)。
2 侵入检测事件后会将所有数据备份寄存器复位。
3 注意一点的是:在BKP_CR的TPE位允许使能之前,一当有侵入检测引脚产生的侵入检测事件也是有效的。这一点有利 于更好的保护数据。
4.一当TPAL=0(或1),如果在在BKP_CR的TPE位允许(侵入检测引脚允许位)使能之前TPAL=1(或0),则一旦允许了侵入检测功能,则会产生一个额外的侵入事件。尽管BKP_CR的TPE(侵入检测引脚允许位)位为1后并为出现新的沿跳变
5 在一个侵入检测事件被检测到并被清零后,侵入检测引脚应该要禁止掉。当再次在想写数据备份寄存器之前重新设置BKP_CR的TPE位(侵入检测引脚允许位)。这样可以避免侵入检测引脚上仍有侵入检测事件产生时,不断的对数据备份寄存器写操作。
6VDD电源断开时, 侵入检测功能仍有效,位了避免不必要的数据备份寄存器复位,TAMPER引脚外部应连接到正确的电平上。
初始化IO的时候加上这句号:
PWR_BackupAccessCmd( ENABLE );/* 允许修改RTC和后备寄存器*/
RCC_LSEConfig(RCC_LSE_OFF);//关闭外部低速外部时钟信号功能 后,PC13 PC14 PC15 才可以当普通IO用。
BKP_TamperPinCmd(DISABLE); /* 关闭入侵检测功能,PC13可以用作普通IO*/
BKP_ITConfig(DISABLE); /* 禁止TAMPER 中断*/
2、 PA13 PA14 PA15 这三个脚默认是 JTAG脚 ,就算是按照普通IO进行初始化也是不可以正常用的需要添加
GPIO_PinRemapConfig(GPIO_Remap_SWJ_JTAGDisable , ENABLE);
则可以当做正常IO使用
边栏推荐
- arduino pro mini ATMEGA328P 连线和点亮第一盏LED(同时记录烧录失败的问题stk500_recv)
- 微创电生理通过注册:年营收1.9亿 微创批量生产上市企业
- 腾讯二面:@Bean 与 @Component 用在同一个类上,会怎么样?
- How can a novice quickly complete the establishment of a website? Come to the free "fitting room" experience
- [try to hack] at, SC, PS command authorization
- Industry, University, research and application jointly build an open source talent ecosystem | the 2022 open atom global open source summit education sub forum was successfully held
- PHP gets all the dates of this week or the last seven days
- [dark horse morning post] LETV 400 employees have no 996 and no internal papers; Witness history! 1 euro =1 US dollar; Stop immediately when these two interfaces appear on wechat; The crackdown on cou
- GMT installation and use
- Configure jupyter remote server
猜你喜欢

Huawei releases harmonyos 3 and all scene new products, and the smart experience goes further

Tencent two sides: @bean and @component are used in the same class, what will happen?

IRBuilder

Great! Jd.com developed the highly available website construction technology PDF recommended by the first brother. Prepare the water and chew it slowly

Top level "redis notes", cache avalanche + breakdown + penetration + cluster + distributed lock, Nb

leetcode:704二分查找

FlexPro软件:生产、研究和开发中的测量数据分析

Did kafaka lose the message

产学研用 共建开源人才生态 | 2022 开放原子全球开源峰会教育分论坛圆满召开

Tik tok "founder" Yang Luyu, farewell byte?
随机推荐
用C语言开发NES游戏(CC65)11、Metatiles
Developing NES game (cc65) 07 and controller with C language
公司在什么情况下可以开除员工
[apue] 文件中的空洞
用C语言开发NES游戏(CC65)02、什么是v-blank?
HC-05蓝牙模块调试从模式和主模式经历
Introduction to resttemplate
Markdown concise grammar manual
开源社区三十年 | 2022 开放原子全球开源峰会开源社区三十年专题活动圆满召开
FlexPro软件:生产、研究和开发中的测量数据分析
图书馆自动预约脚本
【萌新解题】爬楼梯
Four authentic postures after suffering and trauma, Zizek
1331. Array sequence number conversion: simple simulation question
Laravel form data validation
Developing NES games with C language (cc65) 10. Game cycle
用C语言开发NES游戏(CC65)06、精灵
Develop NES game (cc65) 07 and controller with C language (collision with spirit)
用arduino开发ESP8266 搭建开发环境
Exploration on cache design optimization of community like business