NUC970系列资料之WDT问题及解决办法 1 WDT问题介绍NUC970的必须要通过硬件Power on setting来开启,且开启后无法通过软件来关闭和打开。这样使用起来很不方便。很多客户希望可以在linux下通过软件来控制wdt。 WDT的硬件开关是由PWRON[3]位来控制的,它对应的GPIO是PA.3. 如果要关闭WDT,则需在系统上电前将PA.3拉到低电平。 如果要打开WDT,则需在系统上电前将PA.3拉悬空(因内部有上拉)。
2 WDT 测试情况2.1硬件关闭WDT的情况下测试WDT 系统启动后,运行bsp里wdt_demo程序后,当不喂狗时系统死机但没有触发重启。 /usr # ./wdt_demo Open watchdog0 ok ii = 10 ii = 9 ii = 8 ii = 7 ii = 6 ii = 5 ii = 4 ii = 3 ii = 2 ii = 1 ii = 0 watchdog watchdog0: nowayout prevents watchdog being stopped! watchdog watchdog0: watchdog did not stop! 这说明通过软件无法打开nuc970的WDT 2.2硬件打开WDT的情况下测试WDT 在这种情况下,默认的bsp中u-boot是有喂狗程序的,但引导linux时就没有喂狗程序了,如果linux系统启动时间过长,就会出现系统没启动完就复位的问题。系统启动时间短的是有机会进入系统的,但进入系统如果不立即喂狗就会重启。 ohci_hcd: USB 1.1 ‘Open’ Host Controller (OHCI) Driver nuc970-ohci nuc970-ohci: Nuvoton NUC970 OHCI Host Controller nuc970-ohci nuc970-ohci: new USB bus registered, assigned bus number 2 nuc970-ohci nuc970-ohci: irq 24, io mem 0xb0007000 hub 2-0:1.0: USB hub found hub 2-0:1.0: 2 ports detected usbcore: registered new interface driver usb-storage TCP: cubic registered NET: Registered protocol family 17 Freeing unused kernel memory: 10844K (c033b000 – c0dd2000) BusyBox v1.22.1 (2017-05-19 16:49:44 CST) built-in shell (ash) Enter ‘help’ for a list of built-in commands. ~ # NUC970 IBR 20151008.1735 No Key Boottttttæ“{kæ44aÃÿand_boot U-Boot 2013.04-rc2 (Nov 25 2015 – 13:25:12) CPU: NUC972 DRAM: 64 MiB NAND: 128 MiB MMC: mmc: 0, mmc: 1 In: serial Out: serial Err: serial Net: emac Hit any key to stop autoboot: 0 Using emac device TFTP from server 10.130.11.18; our IP address is 10.130.11.120 Filename ‘970uimage’. Load address: 0x7fc0 在这种情况,系统启动后就运行wdt_demo程序是可以控制WDT正常工作的:正常喂狗时系统正常工作,不喂狗时WDT复位。 NET: Registered protocol family 17 Freeing unused kernel memory: 10844K (c033b000 – c0dd2000) BusyBox v1.22.1 (2017-05-19 16:49:44 CST) built-in shell (ash) Enter ‘help’ for a list of built-in commands. Open watchdog0 ok ii = 10 ii = 9 ii = 8 ii = 7 ii = 6 ii = 5 ii = 4 ii = 3 ii = 2 ii = 1 ii = 0 watchdog watchdog0: nowayout prevents watchdog being stopped! watchdog watchdog0: watchdog did not stop! ~ # NUC970 IBR 20151008.1735 No Key Boottttttæ“{kæ44aÃÿand_boot U-Boot 2013.04-rc2 (Nov 25 2015 – 13:25:12) CPU: NUC972 DRAM: 64 MiB NAND: 128 MiB MMC: mmc: 0, mmc: 1 In: serial Out: serial Err: serial Net: emac 不配置内核Disable watchdog shutdown on close时,当wdt_demo运行结束退出后,linux系统会关闭wdt。 Device drivers—>
[ ] Disable watchdog shutdown on close 测试结果如下: hub 2-0:1.0: 2 ports detected usbcore: registered new interface driver usb-storage TCP: cubic registered NET: Registered protocol family 17 Freeing unused kernel memory: 10844K (c033b000 – c0dd2000) BusyBox v1.22.1 (2017-05-19 16:49:44 CST) built-in shell (ash) Enter ‘help’ for a list of built-in commands. Open watchdog0 ok ii = 10 ii = 9 ii = 8 ii = 7 ii = 6 ii = 5 ii = 4 ii = 3 ii = 2 ii = 1 ii = 0 Stopping WDT is probably not a good idea 系统没有重启,表明linux系统可以通过软件关闭nuc970的WDT。 通过软件关闭WDT后,还能否通过软件来开启WDT呢? 修改Wdt_demo程序在程序喂狗结束后不退出程序,加入一个死循环程序 While(1){} 编译demo程序并保存为wdt_demo1 TCP: cubic registered NET: Registered protocol family 17 Freeing unused kernel memory: 10884K (c033b000 – c0ddc000) BusyBox v1.22.1 (2017-05-19 16:49:44 CST) built-in shell (ash) Enter ‘help’ for a list of built-in commands. Open watchdog0 ok ii = 10 ii = 9 ii = 8 ii = 7 ii = 6 ii = 5 ii = 4 ii = 3 ii = 2 ii = 1 ii = 0 Stopping WDT is probably not a good idea ~ # ~ # ~ # ~ # /usr # ./wdt_demo1 Open watchdog0 ok ii = 10 ii = 9 ii = 8 ii = 7 ii = 6 ii = 5 ii = 4 ii = 3 ii = 2 ii = 1 ii = 0 NUC970 IBR 20151008.1735 No Key Boottttttæ“{kæ44aÃÿand_boot U-Boot 2013.04-rc2 (Nov 25 2015 – 13:25:12) CPU: NUC972 DRAM: 64 MiB NAND: 128 MiB MMC: mmc: 0, mmc: 1 In: serial Out: serial Err: serial Net: emac Hit any key to stop autoboot: 0 Using emac device TFTP from server 10.130.11.18; our IP address is 10.130.11.120 Filename ‘970uimage’. Load address: 0x7fc0 以上测试表明,nuc970的WDT虽然只能由硬件来打开,但硬件打开后,软件就可以正常控制WDT的打开与关闭。 2.3 在硬件打开WDT的情况下,U-BOOT下如何关闭WDT 默认情况下硬件打开WDT后,u-boot是不会关闭WDT的,客户正常使用WDT时希望进入linux系统后再打开WDT。如何在U-boot下关闭WDT呢? 上面测试表明,硬件打开WDT后,是可以通过软件来控制WDT的开关的。所以只要在u-boot的WDT驱动中关闭通过软件关闭WDT即可。 打开wdt的驱动文件,分析发现nuc970的wdt驱动中预留了通过环境变量watchdog来控制WDT的开关的方法。 设置环境变量watchdog=off时,u-boot就关闭WDT。不设置环境变量watchog或设置为其他值,就不关闭WDT。 在u-boot下通过如下命令设置watchog环境变量。 U-Boot>set watchdog off U-Boot>save 设置好以后,重启系统: NET: Registered protocol family 17 Freeing unused kernel memory: 10884K (c033b000 – c0ddc000) BusyBox v1.22.1 (2017-05-19 16:49:44 CST) built-in shell (ash) Enter ‘help’ for a list of built-in commands. ~ # 工作正常,进入系统后不重启,表明WDT已经关闭。
3 NUC970 WDT的使用方法 通过上面的测试,可以总结出nuc970系列芯片WDT的使用方法: 1)要通过硬件power on setting打开WDT,否则WDT不可用 2)设置u-boot下环境变量watchdog=off来关闭WDT 3)进入系统后要使用WDT时打开WDT。 |
NUC970系列资料之WDT问题及解决办法
最新推荐文章于 2023-07-15 15:47:12 发布