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

Problems with timers

I have to evaluate the results obtained for time synchronization in a piconet BTLE through the use of the RBS protocol. For this purpose I use a nRF52 DK as beacons to transmit not connectable advertising packets every second. Two nRF52 DK nodes, which implement different BTLE services and have the S130 softdevice activated, record the time of reception of the beacon and share this information. In this way they are able to construct a map of their relative offset. In this nodes I use TIMER1 to identify the instant of reception of the beacon. This the code for the timer:

void start_timer(void)

{

NRF_TIMER1->MODE = TIMER_MODE_MODE_Timer;

NRF_TIMER1->TASKS_CLEAR = 1;

NRF_TIMER1->PRESCALER = 2;

NRF_TIMER1->BITMODE = TIMER_BITMODE_BITMODE_32Bit;

NRF_TIMER1->CC[0] = 0;

NRF_TIMER1->TASKS_START = 1;

}

uint32_t capture_timer_value(void)

{

uint32_t captured_value;

NRF_TIMER1->TASKS_CAPTURE[0] = 1;

captured_value = NRF_TIMER1->CC[0];

// NRF_TIMER1->TASKS_CLEAR = 1;

return captured_value;

}

When the beacon is received, is called the capture_timer_value() function to capture the timer value. What happens is that the trend of the differences between the times of reception of the beacon relative to the two nodes has a correct average trend, but presents abnormal periodic oscillations. What the cause of this oscillations? Can anyone help me?

image description

Tanks.

Parents
  • The figure shows the time difference between the reception time of the beacons from two nodes; this difference must vary linearly with small oscillations around the linearity. The anomaly is represented by the periodical large oscillations. On the graph the x axis represents the beacon number (beacon packets are numbered at trasmission); the y axis is the time difference in seconds. The fact is that what appen on the trasmitter side is irrilevant: i register tre receive time of the various beacons packets on the recevers and than make the difference.

Reply
  • The figure shows the time difference between the reception time of the beacons from two nodes; this difference must vary linearly with small oscillations around the linearity. The anomaly is represented by the periodical large oscillations. On the graph the x axis represents the beacon number (beacon packets are numbered at trasmission); the y axis is the time difference in seconds. The fact is that what appen on the trasmitter side is irrilevant: i register tre receive time of the various beacons packets on the recevers and than make the difference.

Children
No Data
Related