I have never used the watchdog before but I expected it to be easy to set up just like most other things. I soon had it working and after realizing that it would stay enabled after reset (oups) most was OK.
But there is one strange thing. I had to enable the watchdog twice to make it take the prescaler bits! I followed the instructions of the datasheet at the description of WDTCSR. First write WDCE and next WDE + prescaler.
But this is obviously wrong way to do it! It works but the prescaler bits will be set the SECOND time I make the operation.
I wasn't satisfied by this unpredicted behavior so I searched the datasheet for more information and found that to disable the Watchdog, the write operation is slightly different than from what you get from reading the description of WDTCSR.
First write WDCE AND WDE, next write WDE (1 or 0). I changed the enable sequence to the same and now it works the first time.
First write WDCE and WDE, second write WDE + prescaler.
If the correct operation is as described it is very strange that it still works to turn it on with the first method. Turning off works even if I follow the first method, it even writes (only tested to cleared them) the prescaler bits..