Sinan,
> I achieved 0x500000 microsecond periodicity by such a way:
>
> - I set a milli timer of (of 0x1400 milliseconds)
> - I store the local time at the first fire ıf the timer at a variable called
> "pulse"
> - At each timeout of the timer, I add 0x500000 to the "pulse" variable
> - And I give "pulse" as a parameter to TimeSyncAMSend.send(...)
This approach assumes that the micro clock is ticking _exactly_ at
1048576Hz. The problem is that the frequency of the DCO clock is very
imprecise and it does have a significant drift as well. It's not
unseen that you even lose the UART connection to a node because of the
excessive drift. I'm concerned that this approach will not work.
Why don't you try saving the local time not only in the first but in
all subsequent timer firings, and compare it to the "expected" time
(or pulse, as you call it). I bet you'll be seeing huge differences
already there.
> For the timestamping issue, as I said before I was not using your cc2420
> stack. I am using the stack at the current tinyos-2.x repository. I have
> made there a minor change at the CC2420TransmitC and CC2420TransmitP files:
>
> configuration CC2420TransmitC {
> ...
> ...
> }
>
> implementation {
>
> ...
> ...
> components AlarmHybridMicro32C;
> CC2420TransmitP.LTime -> AlarmHybridMicro32C;
>
> }
>
> module CC2420TransmitP @safe() {
> ...
> uses interface Alarm<TMicro, uint32_t> as LTime;
> }
>
> implementation {
>
> ...
>
> // this method converts a 16-bit timestamp into a 32-bit one
> inline uint32_t getTime32(uint16_t captured_time)
> {
> uint32_t now = call LTime.getNow();
>
> // the captured_time is always in the past
> return now - (uint16_t)(now - captured_time);
> }
>
> async event void LTime.fired() {
>
> }
>
> }
>
> Do you think there may be some problem here? Since the captured timestamp is
> 16 bits, the conversion to 32 bits is needed. Am I doing something wrong?
This seems correct.
Janos
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help