This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

time synchronization across different nodes in a mesh network, single hop as well as multi hop.

I am working on time synchronizations between different nodes in a mesh network. I have earlier worked on the radio and the ppi examples given. I wish to generate time stamps at each send and receive events between two different nodes for which i am using the nRF radio along with two crystal oscillators, 16 M XOSC as well as 32.768 KHz XOSC with quartz crystal. Could you let me know that if i am using the ppi with the radio functionality, how do i define the two nodes in my code between which i want to send packets. then can i extend this case for n nodes too.

Parents
  • Yes I can see start_reciever() but I don't see when it's called.

    Yes, using wireshark and analyser is for verification. The question is how you are planing to do the actual time synchronization ? Do you have an idea of what you are trying to achieve ?

    Basically please explain what you meant here: I wish to generate time stamps at each send and receive events between two different nodes for which i am using the nRF radio

    The main point of time synchronization is to calibrate multiple devices to start a timer at the same time. By having the synchronized timer we can add a time stamp on every data we sample or execute a command at the same time.

    What we do in the example I pointed you to (which only takes 15 minutes to read and 5 minutes to test ) is to do TASKS_CAPTURE on the timer of the master, add the latency (consistent time delta by using another timer), then put that value in the radio packet.

    On the receiver/slave side, when receiving the packet, it uses that timer captured value to update its own timer with that value (includes the delta). After that the timers on both device should be synchronized.

    Note that this solution is only for a start network, where one single node can update multiple nodes around it. I don't know how do you plan to do it for a mesh network. That why I keep asking how do you plan to do your mesh.

    And yes, we don't have a solution to avoid CPU involve here. We need the CPU to put the captured timer value to radio packet. But we can have a consistent time for doing that by using another timer and PPI to start radio transmission a fixed time after the capture task.

Reply
  • Yes I can see start_reciever() but I don't see when it's called.

    Yes, using wireshark and analyser is for verification. The question is how you are planing to do the actual time synchronization ? Do you have an idea of what you are trying to achieve ?

    Basically please explain what you meant here: I wish to generate time stamps at each send and receive events between two different nodes for which i am using the nRF radio

    The main point of time synchronization is to calibrate multiple devices to start a timer at the same time. By having the synchronized timer we can add a time stamp on every data we sample or execute a command at the same time.

    What we do in the example I pointed you to (which only takes 15 minutes to read and 5 minutes to test ) is to do TASKS_CAPTURE on the timer of the master, add the latency (consistent time delta by using another timer), then put that value in the radio packet.

    On the receiver/slave side, when receiving the packet, it uses that timer captured value to update its own timer with that value (includes the delta). After that the timers on both device should be synchronized.

    Note that this solution is only for a start network, where one single node can update multiple nodes around it. I don't know how do you plan to do it for a mesh network. That why I keep asking how do you plan to do your mesh.

    And yes, we don't have a solution to avoid CPU involve here. We need the CPU to put the captured timer value to radio packet. But we can have a consistent time for doing that by using another timer and PPI to start radio transmission a fixed time after the capture task.

Children
  • 01200555.pdf

    This is a part of my thesis work basically. I am using the tiny sync algorithm to achieve this. Refer to fig 1 and then section 4 on page 1270. basically i need to collect the three time stamps, t_o, t_b and t_r for each probe message sent. The packet itself would be carrying the timestamp to the destination.

    U mean to say that while using timers too for all events we would always be requiring the CPU. Although timers have the inbuilt functionality to minimize CPU intervention. There are probably some related tasks of Nordic in the SDK itself that have been done without using CPU. But i still need to figure out how to do the capture tasks independent of the CPU.

  • Also i would be just using capture events for capturing the event times. So no compare events will be involved.

  • Thanks for providing the document. My understanding is that you need to capture time stamp on both side and your approach require time-stamp packet from both direction to do calculation and estimate a12, b12 from that.

    Our approach is a little bit different that we only use packet from one direction and try to reset the timer on node 2 to set the offset b12 to zero using the time stamp. We reduce the affect of the drift a12 by keep sending time stamp packet so that the drift create by the timer won't exceed the real time requirement.

    You can re-use what we implemented in our example on the transmission side. Use PPI to trigger a TASK_CAPTURE of the free run timer from COMPARE event of another timer (TIMER2) (You can ignore this, and trigger TASK_CAPTURE your way) Then use CPU to put the Captured value of the freerun timer to radio packet. Then TIMER2 will trigger the transmission of the radio after that using PPI. (This is important and shouldn't be ignored) The involvement of the CPU here is only to put the timestamp into radio packet. It wouldn't cause any un-predictable latency because we will use the TIMER2 and PPI to trigger radio. Most of the task is done using PPI and the latency is consistent.

  • Good enough. I will remain in touch with you on this if you don't mind. The CPU intervention problem is solved by using the the PPI itself. But perhaps i need to in initialize it earlier in the process so as to avoid delay. But when we are using timer 0, 1 and 2, are these individual timers present at each of the nodes or these are just separate instances of the same timer on one node. Because as u mentioned we are using one timer and one RTC for each node right.

  • Also as per the algorithm, i need to generate a timestamp t_o just when the packet arrives at node 1. So will it be done using a timer itself and if yes, at what point in the code i need to load the timestamp in the packet.

Related