Watchdog code ki ek bhi line padhne se pehle, ya timeout formula mein numbers daalne se pehle, tumhe karib ek dozen chhote ideas apne andar utaarne honge. Parent note the watchdog topicmaanta hai ki tum pehle se jaante ho ki "counter", "clock", "prescaler", aur "reset" kya hote hain. Yeh page in sabko ek-ek karke, ek-dusre pe depend karne ke order mein, bilkul scratch se banata hai — taaki jab fclock ya Nmax jaisa koi symbol dikhe, tum pehle se jaante ho ki woh kis picture ki taraf point kar raha hai.
Socho ek piano student ke liye metronome: tick… tick… tick… bilkul even spacing pe. Chip mein exactly yahi hota hai, bas millions ticks per second.
Ek clock ko describe karne wala akela number hai uski frequency.
Topic ko yeh kyun chahiye: watchdog ek clock se drive hota hai. Watchdog ka counter kitni tezi se badalta hai, yeh poori tarah is f se set hota hai. Parent formula mein yeh fclock ke roop mein aata hai — specifically watchdog ko feed karne wali clock ki frequency (jo, jaise hum dekhenge, CPU ki clock se often alag, independent clock hoti hai — dekho Hardware Timer Peripherals).
Socho ek numbered dial jisse clock har tick pe ek notch nudge karta hai. Akela chhoda jaaye toh ek down-counter steadily zero ki taraf slide karta rehta hai.
Topic ko yeh kyun chahiye:Nmax woh jagah hai jahan ek fresh watchdog counter count down karne se pehle start karta hai. Watchdog ko "feed" karna matlab hai counter ko wapas Nmax pe slam karna. Jitna bada Nmax, utna lamba zero tak ka slide, isliye yeh seedha set karta hai ki reset se pehle tumhare paas kitna time hai.
Recall
Nmax=2b−1 kyun hota hai, 2b kyun nahi?
Kyunki counting 0 se shuru hoti hai. b bits 2bdistinct values (0 se 2b−1 tak) dete hain, isliye sabse bada single value 2b se ek kam hota hai. ::: 16 bits ke saath: 216=65536 distinct values, top value =65535.
Yahan ek problem hai. Chip ki clock millions baar per second tick karti hai. Ek 16-bit counter sirf 65535 tak rakh sakta hai. Full speed pe yeh ek tiny fraction of a second mein zero pe count down ho jaata — itna fast ki useful na ho. Humein counter ko slower tick karaane ka tarika chahiye.
Socho ek turnstile jo sirf har 64ve aadmi par khulta hai: crowd (fast clock) jaldi aati hai, lekin room (counter) dheere bharta hai.
Topic ko yeh kyun chahiye: prescaler tuning knob hai. Yeh exactly parent ke timeout formula mein prescaler hai. Chhota P → fast counting → short timeout (fast recovery lekin false resets ka risk). Bada P → slow counting → long timeout (slow operations ke liye tolerant). Watchdog timeout choose karna matlab hai P choose karna.
Socho ek boulder ko, jo slowly ek cliff (zero) ki taraf roll kar raha hai, wapas pahaad par push karna. Jab tak tum kaafi baar baar push karte raho, woh kabhi roll off nahi hoga.
Topic ko yeh kyun chahiye: feeding tumhare software aur watchdog ke beech poori interaction hai. Parent mein "feeding strategies" aur "feeding too early / too late" ki saari discussion is ek kaam ke baare mein hai — ki tumhare program mein kab yeh instruction perform karte ho.
Topic ko yeh kyun chahiye: "zero pe pahunchna → reset ya interrupt" watchdog ke existence ka poora point hai. Yeh samjhe bina ki reset actually ek running program ke saath kya karta hai, "it resets the system" ka koi matlab nahi.
Topic ko yeh kyun chahiye: yeh teen symbols "Window Watchdog" section ki poori vocabulary hain. Tfeed bas woh time hai jab tumhara code feed instruction actually call karta hai, last feed se measure karke.
Yahi wajah hai ki parent "separate clock source" par zor deta hai — aur kyun ek watchdog ek genuine Safe State Design tool hai, sirf ek fancy timer nahi.
Isse bottom-up padho: clock aur bits milke ek counting counter banate hain, prescaler uski speed set karta hai, isse timeout milta hai, feeding usse reset karta hai, aur zero pe pahunchna reset fire karta hai — yahi watchdog hai.