contiki-os / contiki

The official git repository for Contiki, the open source OS for the Internet of Things
http://www.contiki-os.org/
Other
3.71k stars 2.58k forks source link

TSCH get timestamp from the packet with cc2650 chip #2005

Closed SoonSYJ closed 7 years ago

SoonSYJ commented 7 years ago

Time synchronisation is embedded in TSCH MAC library. The basic idea behind time synchronisation is exchanging radio timestamps between nodes. After reading the code about TSCH, I have got a confusion. In file "tsch-slot-operation.c", a node get the RX time when a packet is received by calling; NETSTACK_RADIO.get_object(RADIO_PARAM_LAST_PACKET_TIMESTAMP, &rx_start_time, sizeof(rtimer_clock_t)); As I am using cc2650 chip in IEEE mode, the _NETSTACKRADIO protocol is linked to ieee_mode_driver @{contiki/cpu/cc26xx-23xx/rf-core/ieee-mode.c}. By calling the _getobject() function, I can get the _last_packettimestamp variable. And _last_packet_timestamp_ is updated by the read_frame() function when a proper packet is received. Here I find that the radio relevant params such as rssi, lqi, payload and timestamp are extracted from a buffer called _rx_readentry.

And I can not understand:

  1. How the radio params is passed to this buffer?
  2. What's the structure of this buffer? I mean that the position and length of each element in this buffer. I have found a figure from the cc13xx cc26xx reference manual, but it seems not right. b2b0015b-6308-4747-8c33-80cd258073b6 Please anyone give me some advice
g-oikonomou commented 7 years ago

https://github.com/contiki-os/contiki/wiki#help