kubabuda / ecat_servo

Open EtherCAT CiA402 servo drive implementation
GNU General Public License v2.0
164 stars 50 forks source link

Watchdog is not working #5

Open qiayuanl opened 1 year ago

qiayuanl commented 1 year ago

Your code and documents are awesome! Thank you for your sharing.

In SOES_CIA402_AX58100, you set watchdogcnt in check_dc_handler(). The comments and the variable names indicate that you consider each count of watchdogcnt as a nanosecond.

Yet, the DIG_process(DIG_PROCESS_WD_FLAG) in each while(), which subtracts the watchdog value between the duration, which is the processing time of while() (dozens of micorsenconds in my case). So the watchdog value is almost never below zero.

I am wondering there's any misunderstanding of the program about watchdog in your code?

kubabuda commented 1 year ago

Well, in normal operation watchdog value is expected not to reach zero. To be honest, I have not done final parameter tweaking. This value is from bringup stage, when I was mostly concerned with making it large enough, so that ESC would not reset itself in loop. This surely can be done better