Saturday, February 28, 2015

Experience on BladeRF

Receiver:
The challenges needs to realize:
- The power of GPS signal at the receiver is about -160dBW, but the BladeRF sensitivity is about -130dBW. Consequently, we need an active antenna with 30dB or more in gain.
- The USB 2.0 is more stable than 3.0, but the speed is much lower than 3.0. Particularly, laptops have very unstable USB ports, this problem is taken into account in the experience.
- There is no detector to recognize the loss of samples.
 Scenario:
Step 1, Connect the bladeRF with the active antenna in NavSAS Lab
Step 2, Collect the signal and observe the received signal in the Oscilloscope. The following commands is given by http://bladerf.blogspot.it/2014/01/finally-i-can-see-gps-satellites-with.html for collecting signal:

[WARNING] extract_field: Field checksum mismatch
[WARNING] Could not extract VCTCXO trim value
[WARNING] extract_field: Field checksum mismatch
[WARNING] Could not extract FPGA size
bladeRF> load fpga hostedx115.rbf
Loading fpga from hostedx115.rbf...
Done.
bladeRF> print frequency

  RX Frequency: 1000000000Hz
  TX Frequency: 1000000000Hz

bladeRF> set frequency 1575420000

  Set RX frequency: 1575420000Hz
  Set TX frequency: 1575420000Hz

bladeRF> set samplerate 4000000

  Setting RX sample rate - req:   4000000Hz, actual:   4000000Hz
  Setting TX sample rate - req:   4000000Hz, actual:   4000000Hz

bladeRF> set bandwidth 2.5E6

  Set RX bandwidth - req:  2500000Hz actual:  2500000Hz
  Set TX bandwidth - req:  2500000Hz actual:  2500000Hz

bladeRF> set rxvga1 30
bladeRF> set rxvga2 30
bladeRF> rx config format=csv n=40000 file=/temp/AKIEL.csv
bladeRF> rx start
bladeRF> rx config format=csv n=40000 file=/temp/BKIEL.csv
bladeRF> rx start
bladeRF> rx config format=csv n=40000 file=/temp/CKIEL.csv
bladeRF> rx start
bladeRF> rx start
bladeRF> rx start
bladeRF> rx config format=csv n=40000 file=/temp/DKIEL.csv
bladeRF> rx start
bladeRF> rx start
bladeRF> rx start
bladeRF> rx config format=csv n=80000 file=/temp/CKIEL.csv
bladeRF> rx config format=csv n=80000 file=/temp/DKIEL.csv
bladeRF> rx start

bladeRF> rx start
bladeRF>

Step 3, Using Matlab-based-GNSS-RX to acquire and track the signal
Step 4, Increasing the sampling frequency and repeat steps from 1 to 3,

Transmitter:

Friday, January 9, 2015

Implementing PLL/FLL/DLL in GNSS RX

1. Basic scheme (Kaplan 2006)
The given scheme for PLL and DLL in the tracking loop of GNSS RX
In tracking loop filters part, we have presented the common scheme of tracking loop filter for digital receiver. We will compare the PLL/DLL in GNSS RX with the common scheme. The given scheme actually contains 2 blocks (PLL and DLL). In case of no-noise, they work separately. Unfortunately, in reality, 2 blocks must work together. For the sake of simplify, we consider PLL.
Firstly, we have to compute I and Q in EPL channels
I=Ax(n)+noise(n)
Q=Ay(n)+noise(n)
real_error(n)=f(x(n)/y(n))
estimate_error(n)=f(I(n)/Q(n))
DLL affects to the coefficient A. It's clear that A should be maximum value as possible.

Take PLL as an example. We compare PLL and the CTL
1, Discriminator
2, F(z)
3, NCO or D(z)
The updated frequency of NCO is equivalent to sampling frequency Fs=1/Ts. On the other hand, the PLL updated carrier phase every a duration time of integration Td. We will consider the characteristic of NCO in Z-domain:
The output of PLL is often expressed as $\frac{T_d}{2}\frac{d\Phi_k}{dt}$. It's easy to prove that
$$\Phi_{k+1}=\Phi_{k}+T_d/2(\frac{d\Phi_{k+1}}{dt}+\frac{d\Phi_k}{dt})$$.
Therefore:
$$N(z)=\frac{T_d}{2}\frac{z+1}{z-1}$$






Saturday, January 3, 2015

Tracking Loop Filters

1. Introduction to tracking loop filter in GNSS RX
-Tracking loop filter is a well-known concept in control theory. the tracking loop filter in GNSS RX is designed based on its analogous characteristics  to control systems especially tracking stage. To have deeply understanding the tracking loop filter, we have to read them on control system, that would be showed on the reference part of this post. 
- The aim of tracking filter is to estimated the reference parameter as more accurate as possible. In case of noise-free signal, those parameter can be estimated directly. Unfortunately, the incoming signal always includes noise. This leads to the use of loop filter in order to reduce the effect of error. 
- To analyze the characteristic of  a tracking loop filter, we must consider its effect on desired signal and noise separately. In most case, noise is assumed as white Gaussian noise.
2. Tracking loop filter design
We consider 2 kinds of input:
- Step input
- Ramp input
And the noise is assumed as white Gaussian noise
That leads to 2 kinds of filters namely: first-order and second-order filters
a, Signal combination
The input signal $y[k,\xi]$ is combined with the reference signal $y_{ref}[k,\hat{\xi}[k]]$. The local reference signal have the same basic structure to input signal. We try to make a 'copy version' of the input signal but we don't know exactly the parameter $\xi$. Consequently, we have to design a system to estimate that parameter.
b, Discrimination function
The objective of the function is to extract the error $\hat{\xi}[k]-\xi$ from the combined signal $z[k,\xi]$
c, Low-pass loop filter
Unfortunately the input signal includes not only the desired signal but also noise. The filter reduces noise in order to get the more accurate estimate of $\xi$
d, Parameter estimation
The estimated parameter $\hat{\xi}$ must be updated every loop with the difference between input and local signal.
$$\hat{\xi}[k+1]=\hat{\xi}[k]+\epsilon_{\xi}[k]$$
e, Delay
The block characterize the behavior of the estimate will be utilized in next loop
f, Reference signal generator
Generate the signal 

The linearized model can be expressed as following:



$$\hat{\xi}[z]=(\beta\delta_{\xi}[z]+\eta[z])F(z)D(z)$$
$$\delta_{\xi}[z]=\xi[z]-\hat{\xi}[z]$$
$$\Rightarrow\hat{\xi}[z]=\frac{{\beta}F(z)D(z)}{1+{\beta}F(z)D(z)}\xi[z]+\frac{F(z)D(z)}{1+{\beta}F(z)D(z)}\eta[z]$$
$$\Rightarrow\delta_{\xi}[z]=\frac{1}{1+{\beta}F(z)D(z)}\xi[z]-\frac{F(z)D(z)}{1+{\beta}F(z)D(z)}\eta[z]$$
Transfer functions from $\xi[k]$ and $\eta[k]$ to $\hat{\xi[k]}$
$$G_\xi(z)=\frac{{\beta}F(z)D(z)}{1+{\beta}F(z)D(z)}$$
$$G_\eta(z)=\frac{F(z)D(z)}{1+{\beta}F(z)D(z)}$$
Transfer functions from $\xi[k]$ and $\eta[k]$ to $\delta{\xi[k]}$
$$H_\xi(z)=\frac{1}{1+{\beta}F(z)D(z)}$$
$$H_\eta(z)=-\frac{F(z)D(z)}{1+{\beta}F(z)D(z)}$$
It's easy to indicate the function D(z)
$$\hat{\xi}[k+1]=\hat{\xi}[k]+\epsilon_\xi[k]$$
$$\Rightarrow{D(z)}=\frac{1}{z-1}$$
2.1. Noise-free signal
We consider the behavior of tracking filer with 2 kinds of input:
Step input $\xi[k]=Au[k]$ ($\xi(z)=\frac{Az}{z-1}$) and ramp input $\xi[k]=Aku[k]$  ($\xi(z)=\frac{Az}{(z-1)^2}$)
We expect our estimate convergence to the true value. Moreover, the final value theorem states as following expressions:
$$\lim_{k\rightarrow\infty}f[k]=\lim_{s\rightarrow0}sf(s)=\lim_{z\rightarrow1}(z-1)f(z)$$
It's clear that:
For first-order LP, $F(z)=\gamma$
$$\lim_{z\rightarrow1}(z-1)\xi_{step}(z)=0$$
$$\lim_{z\rightarrow1}(z-1)\xi_{ramp}(z)=\frac{A}{\beta\gamma}$$
For second-order LP, $F(z)=\frac{az+b}{z-1}$
$$\lim_{z\rightarrow1}(z-1)\xi_{step}(z)=0$$
$$\lim_{z\rightarrow1}(z-1)\xi_{ramp}(z)=0$$
2.2. Signal plus noise
We consider only variance (jitter) at the output of  the filter:
$$\xi_\eta[k]=\eta[k]*h[k]=\sum_{n=0}^{+\infty}h[n]\eta[k-n]$$
$$E(|\xi_\eta[k]|^2)=E(\sum_{n=0}^{+\infty}h[n]\eta[k-n]\sum_{p=0}^{+\infty}h^*[p]\eta^*[k-p])$$
$$=E(\sum_{n=0}^{+\infty}\sum_{p=0}^{+\infty}h[n]\eta[k-n]h^*[p]\eta^*[k-p])$$
$$=\sum_{n=0}^{+\infty}|h[n]|^2E(|\eta[n-k]|^2)=\sum_{n=0}^{+\infty}|h[n]|\sigma^2_\eta$$
$$=\int_{-0.5}^{0.5}|H(j2{\pi}f)|^2{df}$$
$B_{eq}$ is defined as follows:
$H_{eq}(f_a)=H(0)$ where $|f_a|\leq{B_{eq}}$
The bandwidth controls amount of noise allowed in the filter.
$$\int_{-0.5}^{0.5}|H(f)|^2df=T_s\int_{-F_s/2}^{F_s/2}H(f_a)df_a=T_s2B_{eq}H(0)$$
$$\int_{-0.5}^{0.5}|H(f)|^2df=T_s\int_{-F_s/2}^{F_s/2}H(f_a)df_a=T_s2B_{eq}|H(0)|^2$$
$$B_eq=\frac{\int_{-F_s/2}^{F_s/2}H(f_a)df_a}{2|H(0)|^2}$$
$$=\frac{1}{2|H(0)|^2(j2\pi{T_s})}\int_CH(z)H^*(z^{-1})\frac1zdz$$
$$g(z)=H(z)H^*(z^{-1})\frac1z$$
$$=\frac{1}{2|H(0)|^2(j2\pi{T_s})}\sum_kR_g(z_p)$$
$$=\frac{1}{2|H(0)|^2(j2\pi{T_s})}\sum_k\lim_{z\rightarrow{p_k}}(z-p_k)g(p_k)$$
$p_k$ is a pole lie inside the unitary circle C
$$|H(0)|^2=(H(z)H^*(z^{-1}))|z=1$$
a, First-order filter
$$|H(0)|=\frac{1}{\beta^2}$$
$g(z)$ have 2 poles inside C which are $z=0$ and $z=1-\beta\gamma$,
$$\sum_k\lim_{z\rightarrow{p_k}}(z-p_k)g(p_k)=\frac{\gamma^2}{1-(1-\beta\gamma)^2}$$
$$B_{eq}\approx\frac{\beta\gamma}{4T_s}$$
Finally:
$$\sigma^2_\xi\approx\sigma^2_\eta\frac{\gamma}{2\beta}$$
b, Second-order filter
For the filter, we have
$$|H(0)|=\frac{1}{\beta^2}$$
$$H_\eta(z)=\frac{-az+b}{(z-1)^2+\beta(az-b)}$$
$$g(z)=\frac{H(z)H^*(z^{-1})}{z}$$
If $H(z)$ have two poles namely $\alpha$ and $\alpha^*$, $H^*(z^{-1})$ have two poles $\frac{1}{\alpha}$ and $\frac{1}{\alpha^*}$. It's obvious that only two of them lie inside the unit circle. Suppose that $\alpha$ and its conjugate $\alpha^*$
(It's easy to prove that: $\alpha=1-\frac{{\beta}a}{2}+j\sqrt{1-{\beta}b-(1-\frac{{\beta}a}{2})^2}$)
$$B_{eq}=\frac{\beta^2}{T_s}R\{\frac{(a\alpha-b)(a^*-b^*\alpha)}{2jI(\alpha)(1-|\alpha|^2)(1-\alpha^2)}\}$$
$$\sigma_\delta=2\sigma_{\eta}R\{\frac{(a\alpha-b)(a^*-b^*\alpha)}{2jI(\alpha)(1-|\alpha|^2)(1-\alpha^2)}\}$$
The parameters a, b is chosen according to the analogous filter as follows:
$$\rho\approx\frac{4B_{eq}T_s}{1+4\zeta^2(1+2B_{eq}T_s)}$$
$${\beta}b\approx4\zeta^2\rho$$
$${\beta}a\approx4\zeta^2\rho(1+2\zeta^2\rho)$$
In practice damping factor is chosen: $\zeta=sqrt(2)$
As the formula above, jitter depends only the characteristic of filter