I have #define CFG_WDOG in my project,and set the WATCHDOG_DEFAULT_PERIOD 0xFF,
but when I startup the program will go to NMI_HandlerC .
my code can good running before defined the CFG_WDOG,so I think the timeout value is small.
but it's seems that 0xFF is the biggest value it can set.
So I want to ask you,how to changed the watchdog clock to small
Device:
Hi RandyYu,
The WATCHDOG timer is an 8-bit counter clocked with a 10.24ms clock and has maximum value of 2.6 seconds timeout by placing the 0xFF value as a reload value, you can't change the source clock or place a larger value. Is your connection interval or your advertising interval that large that allows your device to keep a connection alive and have the device occupied that long with other than BLE events ? I mean that if your device was functioning properly without the WATCHDOG and was able to keep a connection and with the watchdog you get an NMI_Handler i assume that you have the 580 occupied with other processing activities for a long time but not long enough in order to lose connection. In that case you will have to refresh, freeze or run the watchdog while you are keeping your device occupied by executing your code (handle the watchdog timer from your code). In the SDK when the device operates the watchdog is kept reloading at the end of the main_func() function if you are preventing the processor executing that line in order to reload the watchdog then the NMI will occur.
Thanks MT_dialog
thanks dialog:
I have modified as you said,
i add the if(USE_WDOG)
wdg_reload(WATCHDOG_DEFAULT_PERIOD);
the problem has solved.But after several minutes,the program is dead,but isn't reset at all.
I said that because master can't search my slave,and slave also can't go to sleep,the current is fix on 852μA。
Hi RandyYu,
What kind of error you get ? an NMI due to watchdog timeout ? That means that your code is stuck somewhere without reloading the value of the watchdog. And a reset means that the bootloader will run (if you have undefined the DEVELOPMENT_DEBUG otherwise it will stack to the NMI_Handler), if there is nowhere to boot from your device will keep on executing the bootloader.
Thanks MT_dialog
Yes I know what watch dog used for.
我的问题是:如果我不设置延长睡眠模式,the program will be ok.after several hours test,it's still work well.but when I set set the device to extend sleep mode. after several minutes the curren I measured is 890μA(fixed ,so I think it has dead,-in sleep mode the current is 8.5μA,when wake up in advertise mode the current is about140μA)
I don't know how to check the problem ,So I want enable watch dog.but when it's dead ,the watch dog can not reset and boot the device(the current is fixed in 890μA,and no advertise send ).
If I want use watchdog,does I only used to define CFG_WDOG is ok?or there are have any other configure need to define ?
should I need to undef development_debug,if define the watchtdog?
yes, otherwise it will break, and go to hardfault