-1

Please give me an advice for this:

I want to get the time when a signal is sent from a mote(I was thinking to generate a interruption when the SFD pin gets from 1 to 0) I didn't find a solution for that, but I found this component: Component: tos.chips.cc2420_tkn154.CC2420TransmitP

which provides cc2420Tx which seems to give me the time a need. But I can't manage to use it, as by default it usest the component from cc2420 folder and not the one from cc2420_tkn154 folder.

The main ideea is that I'd like to measure the time from sending the signal to recieving ack. I need Microsecond precision. All these would help me to get the distance between two motes.

Any ideea would be helpfull. I searched all over: forums, tinyos documentantion, examples...

Thank you :)

Gigg
  • 1,019
  • 3
  • 11
  • 20

1 Answers1

0

I do not know how low-level you want to get, but if you have a timer, in nesC you can get the local time every time the timer fires:

uint32_t timestamp;

event void myTimer.fired() {

    timestamp = call myTimer.getNow();
    printf("Timestamp: %ld \n", timestamp);
}

If you do not have a timer, you can use the component LocalTimeMilliC. Add this to your configuration file:

components LocalTimeMilliC;
TestC.LocalTime -> LocalTimeMilliC;

...and in the module section of the implementation:

uses interface LocalTime<TMilli>;

...and in the code:

timestamp = call LocalTime.get();

However, the local time of each mote will start again when you reset the mote. You would have to synchronize the different times. If you want to calculate the distance between motes, this may not be the best way. To cite from the abstract of this paper:

Location of the deployed sensor nodes can be found either by TOA, TDOA or Received Signal Strength (RSS) measurements.

For RSSI, there is a demo in the folder tinyos-2.1.1/apps/tutorials.

Suzana
  • 4,251
  • 2
  • 28
  • 52