> From: "Ian Welch" <[EMAIL PROTECTED]> > Subject: [Tinyos-help] Timer and Atomic Help > > Hello, > I'm implementing a clock on my mote and it seems to drift, I think the > issue is to to too many or too long atomic sections. I was wondering if > someone could explain to me how atomic sections effect interrupts (events) > from the timer module.
This is more a general microprocessor programming question than a TinyOS question, but, as the documentation says, an atomic section prevents interrupt execution, so if your timer fires an interrupt during execution of atomic code, the interrupt will either not be processed or (less likely) will be queued until the atomic section is finished. I don't know of TinyOS being implemented on a controller that can queue interrupts, so it will probably be lost (definitely lost on Mica*s), but that could be a platform dependent behavior. The TinyOS reference docs may define this behavior - I don't know, might be worth checking. Consequently, atomic sections may have to be synchronously designed so that interrupts will be guaranteed to be enabled during a clock tick. That could be doable on a mote platform, but good luck doing it. Another approach is to poll the counter state coming out of every atomic section to determine whether the clock fired while you were in it. Does that scare you? It should. I recommend finding an alternative to building a real time software clock. Regards, Ben Buckner _______________________________________________ Tinyos-help mailing list [email protected] https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
