• No results found

In previous chapters, single channel methods based on LSE fitting are introduced and discussed. In BLE standard, the advertising always happens on three channels. It is natural to think and use this feature for multiple channel ranging method. For this purpose, we need a special scanner that receives all three ADV packets from the same event. Because the special changes and ranging algorithm only run on the scanner side and the advertiser can be any BLE device, we call this method “asymmetric”. New algorithm and experimental setup are needed for asymmetric multiple channel ranging.

5.1 Algorithm

In Section 3.1.1, we establish the mathematical model for the BLE RX signal. The RX phase is given by Eq.

(3.8).

φ𝐼𝐼𝐼𝐼(𝑡𝑡) = 𝜑𝜑𝑚𝑚(𝑡𝑡 −𝑟𝑟𝑐𝑐) + 2𝜋𝜋∆𝑓𝑓𝑡𝑡 − 2𝜋𝜋𝑓𝑓𝑐𝑐𝑟𝑟𝑐𝑐+ ∆𝜑𝜑 (3.8) We can see from Eq. (3.8) that the received phase after IF filtering contains distance information in the GFSK modulated phase term and phase term induced by carrier frequency. The first phase term 𝜑𝜑𝑚𝑚(𝑡𝑡 −

𝑟𝑟

𝑐𝑐) has been discussed and tested in single channel ranging. In this ranging method, we study phase term 2𝜋𝜋𝑓𝑓𝑐𝑐𝑟𝑟𝑐𝑐 for range information.

In this method, we receive at least two identical ADV packets on different channels. Because the packet contents are identical (without whitening), the GFSK modulated phase is identical and can be cancelled.

Assuming the carrier phase offset ∆𝜑𝜑 is constant during the ADV event, the phase difference for two ADV packets are

∆𝜑𝜑𝑆𝑆= ∆𝑓𝑓𝑐𝑐𝑟𝑟𝑐𝑐+ ∆𝑓𝑓 ∗ 𝑡𝑡𝐴𝐴𝐴𝐴𝐴𝐴 (5.1)

∆𝑓𝑓𝑐𝑐 is the frequency gap for two channels and 𝑡𝑡𝐴𝐴𝐴𝐴𝐴𝐴 is the interval of ADV packets. The phase is in unit of cycle (2𝜋𝜋). The phase relationship on multiple channels is shown in Figure 5.1. The phase difference is composed of phase ramp due to clock offset, phase offset due to range and a constant phase offset.

Then we can extract distance information by 𝑟𝑟 =∆𝑓𝑓𝑐𝑐

𝑐𝑐∗ (∆𝜑𝜑𝑆𝑆𝑇𝑇− ∆𝑓𝑓 ∗ 𝑡𝑡𝐴𝐴𝐴𝐴𝐴𝐴) (5.2)

The RX phase difference and the carrier frequency offset can be easily obtained based on previous ranging methods. As the ADV packet interval and channels are known, we are able to obtain the range with Eq.

(5.2).

For detailed MATLAB simulation of this algorithm, please refer to [2].

60 Figure 5.1 Phase relationship on multiple channels [2]

According to Eq. (5.2), the range variance is defined by 𝜎𝜎𝑟𝑟2= (∆𝑓𝑓𝑐𝑐

𝑐𝑐)2∗ (𝜎𝜎∆𝜑𝜑2 − 𝜎𝜎∆𝑓𝑓2 ∗ 𝑡𝑡𝐴𝐴𝐴𝐴𝐴𝐴2 ) (5.3)

𝜎𝜎∆𝜑𝜑2 stands for the variance of RX phase difference. It is influenced by the phase noise level in the wireless channel and receiver circuits. 𝜎𝜎∆𝑓𝑓2 is the variance of frequency offset estimation. It is usually the bottleneck for accuracy improvement assuming phase noise is relatively small. So better estimation accuracy of carrier frequency offset, shorter ADV packet interval, larger channel frequency gap and smaller phase noise level can improve the distance accuracy in this method.

5.2 Experimental Setup

For multi-frequency algorithm, we use a normal BLE advertiser in current SDK and a special test mode scanner to capture 3 ADV packets from one ADV event. The concept is shown in Figure 5.2.

Figure 5.2 Experimental setup for symmetric multiple channel ranging The characteristics for three ends in this setup are:

61

• MATLAB

– Data acquisition for IQ data, RSSI and AGC – Avoid conflict with scanning

• Advertiser

– Whitening disabled

– Continuously advertising with packet interval of 1.5ms

• Scanner

– Whitening disabled

– Only receive error-free ADV packet from target device – Receive all 3 ADV packets from the same ADV event – Enable RFPT capture for packets on channel 38 and 39 – Timeout to discard corrupted event

The MATLAB script is basically reused and advertiser is the example from SDK, only scanner program is newly developed.

5.2.1 Scanner

A BLE Direct Test Mode program in Keil environment is provided as the start point. In this program used by internal test team, various RF test modes and user functions are defined to facilitate different test scenarios. These are descripted in Table 5.1.

Test Modes Description

NO_TEST No test is running

START_TX Continuous transmission of test packets with certain period and predefined payload pattern on one channel

START_RX Continuous reception of test packets

N_BURST Transmit N bursts

STOP Stop the current test

RF_CALIBRATION Calibrate all RF settings CONTINUOUS_WAVE

(UNMODULATED) Transmit continuous unmodulated wave on one channel CONTINUOUS_WAVE

(MODULATED) Transmit continuous modulated wave on one channel

User functions Description

rwble_diagport_init() Initiate diagnostic signal settings so that we can map TX_EN, RX_EN, TX_DATA, RX_DATA etc. to port pins for debugging

check_rx_packet() Check the received packets for certain payload pattern enable_rf_diag_irq_user ()

RF_DIAG_Handler() Enable the interrupt on RX_EN and TX_EN rising and falling edges start_timer()

stop_timer() SWTIM0_Handler()

Define timer and interrupt handler

lld_data_rx_check() For each reception, check errors and payload, update packet counter Table 5.1 Test modes and user functions in the BLE Direct Test Mode program

62 In our scanner, START_RX mode is used for packet reception and the Access Address field of packet needs to be set to 0x8e89bed6 to receive the ADV packets. For each packet reception, the function lld_data_rx_check() will check different type of errors and return the contents of payload. If it is the correct target packet, we record RSSI and update packet counters. There are two ways to switch the channel. If you stop and restart the RX, it will take 3ms which is too long to capture the next packet.

Register setting SetBits16(RF_BMCW_REG, CN_WR, 0) will bypass the MAC layer and switch channel immediately. In this way, we can receive three target ADV packets from one event.

In the main routine, first of all, enough memory for the IQ data of 3 ADV packets is allocated. During the first reception, it tries to receive one packet on channel 37 to roughly synchronize with the advertiser.

Then it restarts the RX on three ADV channels and programs the IQ capture settings properly. If all three packets from one ADV event are correctly received, then the program waits for MATLAB to finish data acquisition and restarts the RX for next ADV event. If there is a timeout after 18ms which means a packet is missed on one channel, the program will quit the current RX procedure, reset the stack and start next reception. The program flow chart is shown in Figure 5.3.

The logic analyzer waveform example for ADV packet reception is shown in Figure 5.4. This proves the correct functionality of the application. The TX_DATA and TX_EN shows the three transmitted ADV packets. The packet interval is fixed to 1.5ms. For the first ADV event, the first packet is missed. So there is RX timeout after 18ms. The BLE stack is reset for another reception. From the signal of RX_EN, we can see that all three ADV packets are correctly received from the next two events and the timer is stopped immediately. Due to random ADV event interval defined by BLE, we can see from two correct events that the receiver needs to open for a long time until the first packet is received. In this way, we must use the circular mode of RFPT capture to get packet IQ data within limited memory space.

Figure 5.3 Example logic analyzer waveform for ADV packet reception

63 Figure 5.4 Program flowchart for the scanner in asymmetric multiple channel ranging

The final captured IQ data for 3 ADV packets are shown in Figure 5.5. Because of circular RFPT mode, the start of packet is not in the beginning of samples. Besides, the start of the first ADV packet is not fixed so that we can only use IQ data of packets on channel 38 and 39 for our algorithm for the moment.

64 Figure 5.5 Raw IQ data for 3 ADV packets

5.3 Raw IQ Data Processing

The MATLAB blocks for asymmetric multiple channel ranging is shown in Figure 5.6. From Figure 5.5, we can see that the noise part is located in the middle. If we start the whole processing from the first sample, we experience unknown and large phase error for the unwrapped phase. So in this method we need to start the raw IQ data processing with proper sample offset. For the “Process IQ data” block, we reuse the previous blocks shown in Figure 3.9 to obtain RX phase pattern.

Figure 5.6 MATLAB blocks for asymmetric multiple channel ranging

0 500 1000 1500 2000 2500 3000 3500

-100 0 100

0 500 1000 1500 2000 2500 3000 3500

-100 0 100

0 500 1000 1500 2000 2500 3000 3500

-100 0 100

Iteration 1

Sample nr.

Amplitude

65 According to Eq. (5.2), phase difference ∆𝜑𝜑𝑆𝑆𝑇𝑇 for each ADV packet pair is calculated. Next, we do LSE fitting on only packets from channel 39 to obtain the carrier frequency offset ∆𝑓𝑓 and the phase ramp.

After removing this phase ramp, we can extract range information.

5.4 Results and Analysis

5.4.1 Measurement Results

For this method, we conduct both indoor and outdoor measurements. The indoor environment is the office corridor shown in Figure 3.15 and the outdoor environment is the field which is far from all buildings. The results are shown in Table 5.2 and Table 5.3.

Actual

The estimation of the carrier frequency offset has standard deviation of around 600Hz, the ADV packet interval in the experimental setup is 1.5ms and the carrier frequency difference between channel 38 and 39 is 54MHz. According to Eq. (5.3), the expected distance accuracy is calculated as 5m assuming phase noise level is small. The distance variation is 4-5m which is as expected. But the average distance in both measurements give confusing result :

• We cannot see expected change with different ranges

• There is large difference in average distance between outdoor and indoor measurement 5.4.2 Problem Locating

To locate the problem, we first check the phase difference for ADV packet pairs in channel 38 and 39. The result for one packet pair from 5m outdoor is shown in Figure 5.7. This plot is as expected that noise only causes small variation on phase information. We also check other packet pairs in the same or different measurements. They all return similar small spread. In this case, the standard deviation is 0.016 cycle.

66 Figure 5.7 Phase Difference for ADV one packet pair from 5m outdoor measurement

In Eq. (5.2), the RX phase difference ∆𝜑𝜑𝑆𝑆𝑇𝑇 we need is the phase difference average for one packet pair.

But when we plot the histogram of ∆𝜑𝜑𝑆𝑆𝑇𝑇 for all packet pairs from 5m outdoor measurement, the result is shown in Figure 5.4. The number is spreading everywhere between -1 cycle to 1 cycle.

Figure 5.8 RX phase difference for all packet pairs from 5m outdoor

0 50 100 150 200 250 300 350 400

-0.23 Phase Diff of one packet pair (48-bit)

Phase/2*pi

67 This spreading happens on all indoor measurements, which is shown in Table 5.4. With this large spread for phase difference average, we lose the ToF-related phase information.

Actual Table 5.4 Averaged phase difference for all indoor packet pairs

To obtain the phase difference in Eq. (5.1), we assume the GFSK modulated phase and the carrier phase offset are identical and can be cancelled. The exact bits of three ADV packets are confirmed to be identical without whitening. So we conclude that the carrier phase offset is not constant for each ADV event. This term is derived from phase offset difference of TX carrier wave and RX local oscillator wave. Both radio waves are generated by the RFPLL from the local 16MHz clock. The key role of the PLL is to generate signal with required high frequency and low phase noise. But for the RFPLL used on DA14681, it cannot preserve the phase information while switching in different channels. Same condition happens on both TX and RX ends which causes the trouble. We make suggestions to the design team of next generation PLL to preserve the phase information while switching channels. Besides, to make sure the carrier phase offset is constant, we need to have special designed RFPLL on both ends. So this method will not work for asymmetric concept.

5.4.3 Further Discussion on Range Accuracy

Although this method does not work on the DA14681, it is still interesting to discuss the range accuracy.

In the last section, we find that the expected distance accuracy on the current experimental setup is 5m.

The estimation of clock offset with LSE fitting is down to accuracy of 0.25ppm which is difficult to be largely improved. The ADV packet interval defined in the BLE stack is shown in Table 5.5 [29]. The minimum interval among four ADV types is 0.526ms for the none-connectable advertising. If we can fix the PLL issue, it is possible to achieve accuracy of 1.75m on Dialog chip.

Table 5.5 Advertising packet interval in the BLE stack [29]

Although this method does not work for the current PLL issue, we can estimate the theoretical limit according to the phase difference result in Figure 5.7. In the ideal case, the phase ramp due to clock offset in Eq. (5.2) can reach very small value assuming there is very tiny clock offset or the packet interval on multiple channels is very short. Then the distance accuracy only depends on RX phase difference variance.

This value is around 0.016 cycle in our measurement, so the range accuracy in ideal case can achieve 9cm which is very impressive.

68 Among all the ranging methods, the clock offset is the major source of range error. The ToF variation introduced by clock offset for asymmetric single channel ranging method is give in Eq. (3.17). It can be re-written as

𝜎𝜎𝑟𝑟′=𝑓𝑓𝑐𝑐

𝑐𝑐∗ 𝜎𝜎∆𝑓𝑓 ∗ 𝑇𝑇 (5.4)

The range accuracy introduced by clock offset for asymmetric multiple channel ranging method is give in Eq. (5.5) according to Eq. (5.3).

𝜎𝜎𝑟𝑟′=∆𝑓𝑓𝑐𝑐

𝑐𝑐∗ 𝜎𝜎∆𝑓𝑓∗ 𝑡𝑡𝐴𝐴𝐴𝐴𝐴𝐴 (5.5)

If we ignore the packet interval difference between 𝑡𝑡𝐴𝐴𝐴𝐴𝐴𝐴 and 𝑇𝑇, the key difference lies on ∆𝑓𝑓𝑐𝑐 and 𝑓𝑓𝑐𝑐 in the denominator. In BLE standard, 𝑓𝑓𝑐𝑐= 2.4GHz and the largest ∆𝑓𝑓𝑐𝑐= 80𝑀𝑀𝑀𝑀𝑀𝑀. If the variation of carrier frequency offset is the same, the single channel method can achieve x30 better range accuracy introduced by clock offset than multiple channel method. In another word, the single channel method is more robust against the clock offset.

69