As Bob Paddock wrote: > > I do not see where this clock domain synchronization is accounted for > > in avr/wdt.h wdt_enable().
As *I* read it, this synchronization is something that happens internally to the device, and the SYNCBUSY bit only indicates whether a synchronization is still pending. > > App Note AVR1321 for the RTC32 explains the cross clock domain issue, > > however it doesn't really say what happens in the Watchdog or the RTC > > case if things are not in sync. AVR1310 would be the place to explain this, but even that appnote fails to tell us something about the SYNCBUSY bit. The only mention of it is in the source code examples that accompany appnote AVR1310, encapsulated in the macro WDT_IsSyncBusy(). Basically, they wait until the SYNCBUSY bit is gone after each manipulation of the WDT.CTRL register. That basically matches the suggested code change. I wish the datasheet were a little more explicit here about what user code is expected to do with the SYNCBUSY bit. -- cheers, Joerg .-.-. --... ...-- -.. . DL8DTL http://www.sax.de/~joerg/ Never trust an operating system you don't have sources for. ;-) _______________________________________________ AVR-libc-dev mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/avr-libc-dev
