Phase and Frequency detection Detection of sinusoidal signal - - PowerPoint PPT Presentation

phase and frequency detection
SMART_READER_LITE
LIVE PREVIEW

Phase and Frequency detection Detection of sinusoidal signal - - PowerPoint PPT Presentation

Phase and Frequency detection Detection of sinusoidal signal characteristics Phase Frequency Usually involves some type of feedback. Typically use a local oscillator (DDS) for a comparison. The Analogy PLL The digital World


slide-1
SLIDE 1

Phase and Frequency detection

  • Detection of sinusoidal signal

characteristics

  • Phase
  • Frequency
  • Usually involves some type of

feedback.

  • Typically use a local oscillator

(DDS) for a comparison.

slide-2
SLIDE 2

The Analogy PLL

slide-3
SLIDE 3

The digital World

  • Frequency detection
slide-4
SLIDE 4

The digital World

  • Frequency detection
  • Key components
  • Local oscillator
  • Period detection
slide-5
SLIDE 5

Frequency

  • Frequency detection
  • Key components
  • Local oscillator
  • Period detection
  • Edge detection
slide-6
SLIDE 6

Frequency

  • Frequency detection
  • Key components
  • Local oscillator
  • Period detection
  • Edge detection
  • Frequency compensation
slide-7
SLIDE 7

Frequency

  • Frequency detection
  • Key components (frequency detection)
  • Local oscillator
  • Period detection
  • Edge detection
  • Frequency compensation
  • +/- delta
  • Look at code and simulation.
  • counter.v, dds.v, edge_detect.v,

period_detect.v, freq_detect.v

slide-8
SLIDE 8

The digital World

  • Phase detection
  • We want a fixed phase relationship

between the local osc and input.

  • In the digital world we can control

the phase of the local osc.

  • Not the case with an analog VCO.
  • Need to measure the phase

difference.

slide-9
SLIDE 9

Phase difference

  • Phase difference detection.
  • Similar to period detection.
  • Requires another oscillator and a

counter.

slide-10
SLIDE 10

Phase lock

  • Phase difference compensation.
  • Integrate phase difference to determine

phase correction.

  • Accumulated phase difference vs

frequency?

  • Code and simulations
  • delta_phase_detect.v, phase_lock_osc.v
slide-11
SLIDE 11

Phase ~ frequency

  • When the frequency of the l.o. did

not match the frequency of the input signal:

  • The phase correction showed a slope.
  • This slope is proportional to the

frequency offset.

  • k (d/dt) (phase correction) = freq offset
  • We should be able to measure this

slope to compensate for the frequency offset.

slide-12
SLIDE 12

Manual Calculation

Δt=39.475-22.035 =17.44 us Δn=1744 clock cycles Δϕ=-4864—32640 =27776 (16bp4) = 1736 The frequency offset is estimated as Δϕ/Δn=1736/1744 Δf=.9954~1

slide-13
SLIDE 13

In Hardware

  • Δϕ/Δn=1736/1744
  • Requires division?
  • We can choose the interval in which

to perform the estimation.

  • Use a power of 2 (e.g. 4,16,32 ...).
  • Just need to make sure the

phase_corr does not wrap.

slide-14
SLIDE 14

Frequency Correction

  • The frequency correction is an

accumulation of the freq difference.

  • If f_lo is 100 and the delta is 2, we

need to hold 2. f_lo = 100 + 2.

  • As soon as f_lo = 100 + 2, delta = 0.
  • Updated code and simulation
  • slope_detect.v
slide-15
SLIDE 15

Phase Detection

  • Given an input signal
  • xin(t) = cos(2πfint + ϕ)
  • How do we determine the angle
  • θ = 2πfint + ϕ
  • With just the amplitude?
  • What would you do in matlab?
slide-16
SLIDE 16

Matlab

  • In MATLAB you might do the following
  • y(t) = yr(t) + yi(t) = hilbert(x)
  • in which
  • yr(t) = x(t)
  • Now that we have real and imag
  • θ = atan2(yi,yr)
slide-17
SLIDE 17

Matlab

slide-18
SLIDE 18

Two Key Operations

  • Hilbert Transform
  • atan2
slide-19
SLIDE 19

Hilbert Transform

  • real sinusoid to complex sinusoid.
  • Think about the desired filter

response.

slide-20
SLIDE 20

Hilbert Transform

  • real sinusoid to complex sinusoid.
  • Think about the desired filter

response.

  • Remember our half pass filter.
slide-21
SLIDE 21

Hilbert Transform

  • Can be implemented with a complex

half pass filter that extends from 0 to fs/2.

  • Similar to our previous half pass

filter that extended from –fs/4 to fs/4.

  • Multiplier Free implementation*.

*M. Kumm and M. S. Sanjari, “Digital Hilbert Transformers for FPGAbased Phase-Locked Loops,” in Field Programmable Logic and Applications, 2008. FPL 2008. International Conference on, 2008, pp. 251–256.

slide-22
SLIDE 22

Hilbert Transform Implementation

  • Block design and simulation
  • (non graded HW)
  • Simulation
slide-23
SLIDE 23

atan2 function

slide-24
SLIDE 24

atan2 function

  • In a sense we have already done this in

the fpga.

  • We want to find the rotational angle

that takes us from (x,y) to y=0.

  • Assume x is positive.
  • If x isn’t negate both x and y and add pi to

the result.

  • Now iterate:
  • If y is positive add theta and rotate x,y

clockwise (-theta, remember we are going backwards compared to cos and sin).

  • If y is negative sub theta and rotate x,y

counter-clockwise.

  • The final value of theta_approx will be the

atan2 (assuming the pi is included if neg x).

  • The final value of (x) will be magnitude

sqrt(x2+y2)/.60725

  • post multiply by .60725 to get actual mag.
  • Simulation
slide-25
SLIDE 25

Phase detection

  • Block Diagram
slide-26
SLIDE 26

Simulation