当前位置:网站首页>Uboot adds hardware watchdog
Uboot adds hardware watchdog
2022-07-18 11:42:00 【wandersky0822】
Let's talk about it first. uboot Compilation process :
1.make distclean
2.make defconfig
3. make
Before executing the above , It is also necessary Set up , Such as configuration ARCH CROSS_COMPILE_ wait , Configure this environment variable in embedded development , To form a conditioned reflex . Then you can run the above 3 Step :
1. eliminate ,
2. To configure , This needs to be explained in detail , This step is based on configs/defconfig file , To do some basic configuration , And generate include/config.h The header file .
3. make This is the real compilation
Actually uboot Framework Hardware watchdog is supported in ,
In the series configuration file configs/mx6qsabreauto.h, Definition CONFIG_HW_WATCHDOG
Then realize the following 2 A function , this 2 A function stay watchdog.h Statement in , seeing the name of a thing one thinks of its function , One is initialization , One is to feed the dog ,
void hw_watchdog_init(void);
void hw_watchdog_reset(void);
feed a dog hw_watchdog_reset, stay uboot The frequency of calls in is very high , Don't try to add print information to it , Once you add printf, Will crash .
stay uboot Add watchdog in , In fact, it is not complicated , But my watchdog chip uses MAX6323, This chip is my first 1 Secondary use , It's different from the watchdog I used before , The watchdog I used before DS1832, Just keep feeding the dog , There would be no reset , But this MAX6323, Quite abnormal , Hey, it's not good even if it's fast , You can't feed too slowly , It must be neither fast nor slow , Here's the picture :

This is more troublesome , If in Uboot Pig feeding function provided hw_watchdog_reset() in , If you change the level directly , It will be less than FAST Value of mode , Cause the dog to be fed too fast and reset , So we must control the time of feeding dogs 15ms<t<10s, Only in this way can we satisfy MAX6323 The requirements of .
On the key code , explain : Feeding the dog uses the inside of the chip get_ticks(); Initializing ticks after , The value obtained by this function will always increase , Therefore, this value can be used to make a count , When this count is met , Will be in hw_watchdog_reset() Change the level in ,
void hw_watchdog_reset(void)
{
static int sta =1;
static unsigned long long tim_bak = 0;
unsigned long long ticks = get_ticks();
if(ticks > tim_bak) {
if((ticks-tim_bak) > 1000000)
{
tim_bak = ticks;
if(sta){
sta = 0;
}
else{
sta = 1;
}
gpio_direction_output(IMX_GPIO_NR(4, 30), sta);
}
}
}边栏推荐
- 上位机开发——数据库系列问题一网打尽
- End of summer vacation 2022.6.29-7.13 my trip to Shenzhen (experience)
- On the value of software defect management
- Meshlab之插件式开发
- 【MySql项目实战优化】通过执行计划分析追加索引
- [C language] dynamic address book
- Go read yaml's pit
- PBFT简单介绍
- Codeworks 5 questions per day (average 1500) - day 16
- [MySQL] create a MySQL account and authorize the correct posture
猜你喜欢

2022年全国最新消防设施操作员(初级消防设施操作员)模拟试题及答案

Flink (II) time and window
![[unity3d] toggle of ugui](/img/f4/247ad2ec3d64b960725e1a1deed1bb.png)
[unity3d] toggle of ugui

迅为国产开发板值得入手的三款开发板

【C语言】自定义类型总结

Intel helps open medical service and promote the intellectualization of ultrasonic prenatal examination

【微信小程序】幻灯片效果实现

三级分类的数据表设计和构造API数据

mysql报错 1142 - SELECT command denied to user ‘dev‘@‘localhost‘ for table ‘user‘ (已解决)

Burning firmware of Hongmeng openharmony system for rk3568 development board
随机推荐
转本结束暑假2022.6.29-7.13我的深圳之行(体验)
Financial industry open platform
Shenzhen has launched a pilot project of online signing of construction contracts, and France has greatly contributed to building digitalization
Flink (III) processing function
现货黄金走势图中三条均线的秘密
Calculate the average wage excluding the maximum wage and the minimum wage of the Department (ByteDance interview)
Complete process of invention patent application (from application to authorization)
DataTime module, OS module, Sys module, JSON module, JSON module operation of time module
com.alibaba.fastjson.JSONException: unclosed string
Shutter ShowDialog Popup
Pbft brief introduction
英特尔助力开立医疗推动超声产检智能化
【C语言】结构体、枚举、联合体
jeesite登录流程
上位机开发——数据库系列问题一网打尽
A row of "cranes" in the clear sky: Chinese flying cranes with numbers as wings
Simulated test questions and answers of the latest national fire-fighting facility operator (primary fire-fighting facility operator) in 2022
Camera 画质调试,学习资料分享
Jeesite login process
Flink(五)状态编程