METHOD TO ESTIMATE PHASE AND AMPLITUDE FOR CONTROL OF A RESONANT MEMS MIRROR

Abstract
Techniques to be described herein are based upon the combination of a digital lock-in amplifier approach with a numerical method to yield accurate estimations of the amplitude and phase of a sense signal obtained from a movement sensor associated with a resonant MEMS device such as a MEMS mirror. The techniques described herein are efficient from a computational point of view, in a manner which is suitable for applications in which the implementing hardware is to follow size and power consumption constraints.
Description
TECHNICAL FIELD

This disclosure is related to the field of resonant MEMS device control and, in particular, is related to techniques for estimating the phase and amplitude of a sense signal containing information about the movement of a resonant MEMS device, said techniques being performable using computationally simple operations.


BACKGROUND

A laser scanning projector is a small, portable electronic device. Laser scanning projectors are typically paired to, or incorporated within, user devices such as smart glasses, smartphones, tablets, laptops, depth sensing cameras, or LIDAR, and used to project virtual and augmented reality, documents, images, or video stored on those user devices onto a projection surface, such as a wall, holographic surface, or inner display surface of virtual or augmented reality glasses (for example a wave guide in a coupling window).


Laser scanning projectors are also incorporated within distance determination systems within vehicles to determine information about the vehicles relative to their surroundings, permitting the creation of advanced driver assistance systems.


Such laser scanning projectors typically include a projection subsystem and an optical module. The paired user device serves an image stream (e.g., a video stream, or a pattern projected into an area used for distance determination) to the projection subsystem. The projection subsystem properly drives the optical module to project the image stream onto the projection surface or environment for viewing.


In greater detail, typical optical modules are comprised of a laser source and one or more microelectromechanical (MEMS) mirrors that scan the laser beam produced by the laser source across the projection surface in a projection pattern. By modulating the laser beam (in the case of an image projection system) according to its position on the projection surface, while the laser beam is scanned in the projection pattern, the image stream is displayed.


The projection subsystem controls the driving of the laser source and the driving of the movement of the one or more MEMS mirrors. Typically, the driving of movement of one of the MEMS mirrors is at, or close to, the resonance frequency of that MEMS mirror.


Monitoring of the mirror movement of the one or more MEMS mirrors is performed by the projection subsystem to provide feedback about the operation of the mirror movement so that the driving of the movement of the one or more MEMS mirrors may be adjusted accordingly to maintain the movement as desired. For example, feedback may be used to maintain the one or more MEMS mirrors operating at a given opening angle.


A sample prior art laser scanning projector 10 is now described with reference to FIG. 1A. Here, the laser source and its associated control circuitry are not shown but are understood to be present. The MEMS mirror 11 (also referred to as a micromirror) is driven at resonance by a drive signal Drv generated by drive circuitry 12. A sensor 13, such as a piezoresistive based sensor, is used to generate a sense signal Sns in response to the movements of the MEMS mirror 11.


Phase feedback circuitry 20 receives the drive signal Drv and sense signal Sns as input, and generates therefrom a frequency signal Fdrive instructing the drive circuitry 12 at what frequency and phase to generate the drive signal Drv.


Amplitude feedback circuitry 30 receives the sense signal Sns as input and from it generates a drive voltage signal Vdrive instructing the drive circuitry 12 at what voltage to generate the drive signal Drv.


Details of the phase feedback circuitry 20 and amplitude feedback circuitry 30 will be given below, but first a mathematical discussion of operation of MEMS mirrors at resonance is presented.


A resonant MEMS mirror can be considered to behave as a second-order filter, mathematically represented as:






H

s

=



H
0



ω
0



2




s
2

+



ω
0


Q

s
+

ω
0
2







Here, ω0 represents the natural frequency of the mirror, Q is the quality factor of the mirror and H0 is the DC gain.


The magnitude response of a resonant MEMS mirror represents its opening angle and can be mathematically represented as:






M

ω

=



H
0



ω
0



2









ω


ω
0




2

+







ω
0


Q

ω



2









Here, ω represents the current frequency of the resonant MEMS mirror (as determined from a sense signal generated by a mirror sensor associated with the mirror).


The phase response φ of a resonant MEMS mirror represents the delay between the drive signal and the mirror, and can be mathematically represented as:






φ

ω

=

a
t
a
n




2
Q



ω
0



ω
+


4

Q
2


1





a
t
a
n




2
Q



ω
0



ω
+


4

Q
2


1








At resonance, a resonant MEMS mirror as indicated by the sense signal responds with a specific phase value with respect to the driving signal, and the drive signal and sense signal are in phase quadrature.


When a resonant MEMS mirror is operated at resonance, for a given voltage of the drive signal, the resonant MEMS mirror is opened to a wider opening angle and, for a specific opening angle, requires a lower voltage drive signal. During operation, the frequency of the drive signal is to therefore to be set to maintain the drive signal and the sense signal as being in phase quadrature to maintain resonance, and the voltage of the drive signal is to be set to maintain the drive signal at a specific voltage to maintain a desired opening angle of the resonant MEMS mirror.


Therefore, during operation of the laser scanning projector 10, the phase feedback circuitry 20 generates the frequency signal Fdrive based upon the feedback of the drive signal Drv and the sense signal Sns so as to maintain the drive signal Drv and sense signal Sns in phase quadrature, and the amplitude feedback circuitry 30 generates the drive voltage signal Vdrive so as to maintain the voltage of the drive signal at a desired voltage to achieve a desired opening angle of the MEMS mirror 11.


The phase feedback circuitry 20 includes a phase estimator 21 that receives the drive signal Drv and sense signal Sns, and generates therefrom a phase φ, indicative of a phase shift between Drv and Sns. An error amplifier 22 compares the phase φ to a target phase φtarget, and generates a phase error φerror as an indication of the difference between φ and φtarget. A phase controller 23 generates a tuning signal PLLfrac to adjust the output frequency generated by a fractional phase locked loop (PLL) 24 from which the frequency signal Fdrive is adjusted to bring φerror to zero. The frequency of the drive signal Drv as generated by the drive circuitry 12 is set to match the frequency of Fdrive. It is understood that even though we PLL circuitry 24 is referred to herein, the driving frequency could also be generated by any programmable oscillator, and that the use of a PLL is simply an example.


The amplitude feedback circuitry 30 includes an amplitude estimator 31 that receives the sense signal Sns as input and generates an amplitude A as being representative of the amplitude of the sense signal Sns. An error amplifier 32 compares the amplitude A to a target amplitude Atarget and generates an amplitude error signal Aerror as an indication of the difference between A and Atarget. An amplitude controller 33 generates a voltage signal Vdrive that drives Aerror to zero. The amplitude of the drive signal Drv as generated by the drive circuitry 12 is set to match the amplitude of Vdrive.


The estimation of the phase shift between the drive signal Drv and sense signal Sns is now described.


A sample drive signal and sense signal are shown in FIG. 1B, with the drive signal being a square wave and the sense signal being a sinusoid. The drive signal can be mathematically represented as a square-wave voltage whose amplitude is Vdrive and fundamental frequency is ωdrive:






d
r
i
v
e

t

=
V
d
r
i
v
e

s
q
u
a
r
e



ω

d
r
i
v
e



t






The sense signal can be mathematically represented as:






s
e
n
s
e

t

=
A
s
e
n
s
e

sin



ω

s
e
n
s
e



t
+

φ

s
e
n
s
e








Here, Asense is the amplitude of the sense signal, ωsense is the frequency of the sense signal, and φsense is the phase of the sense signal with respect to the driver.


A first known technique for estimating the phase shift Φ between the drive signal and the sense signal is described with reference to FIG. 1C. In this graph, zero crosses of the drive signal and sense signal have been estimated and are represented as the rectangular signals ZCsense and ZCdrive, and a number of cycles of the system clock SYSclk between a rising edge of the zero crossing sense signal ZCsense and a rising edge of the zero crossing drive signal ZCdrive are calculated. From this, the phase shift between the drive signal and the sense signal can be estimated. However, this estimation may be too coarse for high frequency MEMS mirrors (which have high frequency drive signals), and the zero cross estimation of the sense signal itself may be insufficiently accurate depending upon the sampling rate. The insufficient accuracy of the zero cross estimation is generally due to the need for extra processing techniques (for accurate zero cross event detections) and faster clock frequencies (for higher time resolutions).


A second known technique for estimating the phase shift between the drive signal and the sense signal is described with reference to FIG. 1D. Keep in mind that the following is not a direct computation of a phase shift in the strict sense thereof, but instead is an indirect estimation of the phase shift, which is useful when, as explained, the sense signal is sampled at two constant (and potentially symmetrical) locations. Here, the sense signal is sampled at two constant locations per cycle - in the illustrated example, the samples are taken at π/2 and /2 of the cycle of the sense signal. The phase shift Φ may then be calculated as:






P
h
a
s
e

S
h
i
f
t

Φ=


S
a
m
p
l
e
2

S
a
m
p
l
e
1


A
s
e
n
s
e






The limitations here are that an accurate estimation of the amplitude Asense of the sense signal is required for normalization, and that the samples themselves and the timing thereof must be accurate in order to yield an accurate estimation of the phase shift.


A first known technique for estimation of the amplitude of the sense signal is shown in FIG. 1E. Here, the sense signal has been sampled at two different sampling rates. The outer illustrated curve 1 represents the sense signal as sampled at a rate of 8192 samples per mirror cycle, and the inner illustrated curve 2 represents the sense signal as samples at a rate of 16 samples per mirror cycle. This illustrates the issue with using a low sampling rate. In the case where 16 samples per mirror cycle is used, the highest sample has a value of 0.9859 when the true amplitude of the sense signal is 1, which represent a 1.41% error that may be unacceptable for many applications. Utilizing a high sampling rate, however, consumes excess power and requires a high frequency analog-to-digital converter.


A second known technique for estimation of the amplitude of the sense signal is shown in FIG. 1F. Here, interpolation is used to determine the maximum value of the sense signal, said interpolation being based upon samples of the sense signal and user-specified phase coordinates. However, the phase coordinates must be accurately determined, otherwise the interpolated peak value may not be accurate, and this requires an undesirable amount of computational resources. In addition, the tuning of the interpolation point locations makes the system calibration stages more time consuming and more burdensome to address.


In the above examples of phase shift and amplitude estimation that rely upon samples, bandpass filtering is performed to clear noise, such bandpass filtering requiring a high amount of computational resources in order to provide the needed performance, adding a further challenge and drawback to the usage of such techniques. Also, some of the above examples require that the MEMS mirror be locked at resonance prior to opening angle determination, which involves obtaining additional samples placed at sense peaks, adding even more complexity.


Prior solutions have been found to yield poor results when estimations (and control loops are implemented directly on hardware like application specific integrated circuits (ASICs), where few computational resources are available, and both area and power consumption are challenging aspects (meaning high clock frequencies and sampling rates cannot be afforded).


As such, current techniques for phase shift and amplitude estimation (e.g., current implementations of the phase estimator 21 and amplitude estimator 31 described above with reference to FIG. 1) are less than ideal, and further development is needed. Indeed, the challenge to be addressed is essentially how to perform such estimations accurately enough when few hardware resources are available.


SUMMARY

Disclosed herein is a method of operating a micro-electro mechanical systems (MEMS) device. The method includes: driving the MEMS device with a drive signal; sensing movement of the MEMS device caused by the drive signal, and generating a sense signal indicative of the movement; using a rotation-matrix approach to generate a reference cosine wave and a reference sine wave, the reference cosine wave and reference sine wave each having an amplitude of 1 and a same frequency as that of the sense signal; multiplying the sense signal by the reference sine wave to produce a first product; multiplying the sense signal by the reference cosine wave to produce a second product; low-pass filtering the first product to produce a first intermediate output; low-pass filtering the second product to produce a second intermediate output; performing a 4-quadrant CORDIC technique on the first and second intermediate outputs to thereby determine a phase shift between the sense signal and the drive signal as well as an amplitude of the sense signal; comparing the phase shift to a target phase shift to produce a phase error as a difference therebetween; comparing the amplitude of the sense signal to a target amplitude to thereby produce an amplitude error as a difference therebetween; and modifying the drive signal based upon the phase error and the amplitude error so that the phase error and amplitude error are eliminated.


The method may include digitizing the sense signal prior to multiplication by the reference sine and cosine waves, and the reference sine and cosine waves may be generated in digital form.


The low-pass filtering of the first product may serves to remove intermodulation components from the reference sine wave, and the low-pass filtering of the second product may serve to remove intermodulation components from the reference cosine wave.


The low-pass filtering of the first product may be performed using a first decimation SINC filter, and the low-pass filtering of the second product may be performed using a second decimation SINC filter.


Performing the 4-quadrant CORDIC technique may be accomplished by:

  • a) defining an index i having integer values ranging from 0 to N-1, with N being the total amount of CORDIC iterations;
  • b) precalculating N angles θi such that for each of the N angles, tan (θi) = 2-i;
  • c) determining a starting coordinate set X0, Y0 from the two SINC outputs (i.e. Y and X);
  • d) If X>=0, setting Δθ=0 as a starting point, else if X<0, then if Y>0 setting Δθ = + 180, else setting Δθ = -180. Also, rotating the starting X,Y coordinates by 180° by setting X=-X and Y=-Y;
  • e) for a first number i=0 in the index, setting a next coordinate set X1, Y1 to be such that X1=X0-(Y0 >> 0) and Y1=Y0+(X0 >> 0) and determine a phase Δθ = Δθ - θi if Y0 ≤ 0, but setting the next coordinate set X1,Y1 to be such that X1=X0+(Y0 >>0) and Y1=Y0-(X0 >>0)and determine the phase Δθ = Δθ + θi, if Y0 > 0;
  • f) incrementing i by one;
  • g) for an ith number i in the index, setting a next coordinate set Xi, Yi to be such that Xi+1=Xi-(Yi >> i) and Yi+1=Yi+(Xi >> i) and determine a phase Δθ = Δθ - θi if Yi ≤ 0, but setting the next coordinate set Xi+1,Yi+1 to be such that Xi+1=Xi+(Yi >>i) and Yi+1=Yi-(Xi >>i)and determine the phase Δθ = Δθ + θi, if Yi > 0;
  • h) if i<N-1, return to f); and
  • i) if i=N-1:
    • determine the phase shift as being equal to the phase Δθ and
    • determine the amplitude of the sense signal as being equal to K·XN-1, being
    • K=2i=0N1cosθi.


The rotation-matrix approach may performed by:

  • a) defining an index i having integer values ranging from 0 to N-1, with N being the number of samples per reference cycle;
  • b) determining a rotation amount as being equal to 360°/N and precalculating the (x_rot; y_rot)=(cos(360/N); sin(360/N)) rotation coordinates;
  • c) determining a starting coordinate set X0, Y0, where x0 = cos (φref), y0 = sin (φref), with φref being equal to theinitial phase shift for the reference waves;
  • d) rotating the start coordinate set X0, Y0 by the rotation amount to produce a next coordinate set X1, Y1as X1 = X0 ▪ xrot - Y0 ▪ yrot and Y1 = X0 ▪ yrot + Y0 ▪ xrot;
  • e) incrementing i by 1;
  • f) rotate the coordinate set X1, Y1 by the rotation amount to produce an ith coordinate set Xi, Yi as Xi+1 = Xi ▪ xrot - Yi ▪ yrot and Yi+1 = Xi ▪ yrot + Yi ▪ xrot;
  • g) if i<N-1, return to e); and
  • h) if i=N-1, reset the index to 0, and start over from c).


Also disclosed herein is a system for driving micro-electro mechanical systems (MEMS) device. The system includes: a driver generating a drive signal for the MEMS device; a sensor associated with the MEMS device and generating an output indicative of movement of the MEMS device; an analog to digital converter digitizing the output of the sensor to produce a sense signal indicative of movement of the MEMS device; a reference generator using a rotation-matrix approach to generate a reference cosine wave and a reference sine wave based upon a frequency drive signal, the reference cosine wave and reference sine wave each having an amplitude of 1 and a same frequency as that of the sense signal; and a processing circuit. The processing circuit is configured to: multiply the sense signal by the reference sine wave to produce a first product; multiply the sense signal by the reference cosine wave to produce a second product; low-pass filter the first product to produce a first intermediate output; low-pass filter the second product to produce a second intermediate output; and perform a 4-quadrant CORDIC technique on the first and second intermediate outputs to thereby determine a phase shift between the sense signal and the drive signal as well as an amplitude of the sense signal. The system also includes: a first error amplifier comparing the amplitude of the sense signal to a target amplitude to thereby produce an amplitude error as a difference therebetween; a second error amplifier comparing the phase shift to a target phase shift to produce a phase error as a difference therebetween; and controller circuitry causing modifying of the drive signal based upon the phase error and the amplitude error so that the phase error and amplitude error are eliminated.


The controller circuitry may include: a phase controller generating a PLL control signal based upon the phase error; a phase locked loop (PLL) generating the frequency drive signal based upon the PLL control signal, the driver modifying phase of the drive signal based upon the frequency drive signal such that the phase error is eliminated; and an amplitude controller generating a voltage drive signal to the driver based upon the amplitude error, the driver modifying amplitude of the drive signal based upon the voltage drive signal such that the amplitude error is eliminated.


The processing circuit may be an application specific integrated circuit (ASIC).


The low-pass filtering of the first product may be performed by the processing circuit serves to remove intermodulation components from the reference sine wave, and the low-pass filtering of the second product may be performed by the processing circuit serves to remove intermodulation components from the reference cosine wave.


The low-pass filtering of the first product may be performed by the processing circuit using a first decimation SINC filter, and the low-pass filtering of the second product may be performed by the processing circuit using a second decimation SINC filter.


The processing circuit may perform the 4-quadrant CORDIC technique by:

  • a) defining an index i having integer values ranging from 0 to N-1, with N being the total amount of CORDIC iterations;
  • b) precalculating N angles θi such that for each of the N angles, tan (θi) = 2-i;
  • c) determining a starting coordinate set X0, Y0 from the two SINC outputs (i.e. Y and X);
  • d) If X>=0, setting Δθ=0 as a starting point, else if X<0, then if Y>0 setting Δθ = +180, else setting Δθ = -180. Also, rotating the starting X,Y coordinates by 180° by setting X=-X and Y=-Y;
  • e) for a first number i=0 in the index, setting a next coordinate set X1, Y1 to be such that X1=X0-(Y0 >> 0) and Y1=Y0+(X0 >> 0) and determine a phase Δθ = Δθ - θi if Y0 ≤ 0, but setting the next coordinate set X1,Y1 to be such that X1=X0+(Y0 >>0) and Y1=Y0-(X0 >>0)and determine the phase Δθ = Δθ + θi, if Y0 > 0;
  • f) incrementing i by one;
  • g) for an ith number i in the index, setting a next coordinate set Xi, Yi to be such that Xi+1=Xi-(Yi >> i) and Yi+1=Yi+(Xi >> i) and determine a phase Δθ = Δθ - θi if Yi ≤ 0, but setting the next coordinate set Xi+1, Yi+1 to be such that Xi+1=Xi+(Yi >>i) and Yi+1=Yi-(Xi >>i)and determine the phase Δθ = Δθ + θi, if Yi > 0;
  • h) if i<N-1, return to f); and
  • i) if i=N-1:
    • determine the phase shift as being equal to the phase Δθ and
    • determine the amplitude of the sense signal as being equal to K·XN-1, being
    • K=2i=0N1cosθi.


The processing circuit may perform the rotation-matrix by:

  • a) defining an index i having integer values ranging from 0 to N-1, with N being the number of samples per reference cycle;
  • b) determining a rotation amount as being equal to 360°/N and precalculating the (x_rot; y_rot)=(cos(360/N); sin(360/N)) rotation coordinates;
  • c) determining a starting coordinate set X0, Y0, where x0 = cos (φref),y0 = sin (φref), with φref being equal to theinitial phase shift for the reference waves;
  • d) rotating the start coordinate set X0, Y0 by the rotation amount to produce a next coordinate set X1, Y1as X1 = X0 ▪ xrot - Y0 ▪ yrot and Y1 = X0 ▪ yrot + Y0 ▪ xrot;
  • e) incrementing i by 1;
  • f) rotate the coordinate set X1, Y1 by the rotation amount to produce an ith coordinate set Xi, Yi as Xi+1 = Xi ▪ xrot - Yi ▪ yrot and Yi+1 = Xi ▪ yrot + Yi ▪ xrot;
  • g) if i<N-1, return to e); and
  • h) if i=N-1, reset the index to 0, and start over from c).





BRIEF DESCRIPTION OF THE DRAWINGS


FIG. 1A is a block diagram of a laser scanning projector utilizing prior art control loops.



FIG. 1B is a graph showing the drive signal and sense signal of FIG. 1A and the phase shift therebetween.



FIG. 1C is a graph used in explaining a first known technique for estimating the phase shift between the drive signal and the sense signal of FIG. 1A.



FIG. 1D is a graph used in explaining a second known technique for estimating the phase shift between the drive signal and the sense signal of FIG. 1A.



FIG. 1E is a graph used in explaining a first known technique for estimation of the amplitude of the sense signal of FIG. 1A.



FIG. 1F is a graph used in explaining a second known technique for estimation of the amplitude of the sense signal of FIG. 1A.



FIGS. 2A-2B are graphs used in explaining a digital lock-in amplifier approach disclosed herein for use in determining the phase shift between drive and sense signals in a resonant MEMS device.



FIG. 3 is a schematic block diagram of a laser scanning projector disclosed herein utilizing computationally less intensive control loops.



FIG. 4 is a trigonometric circle used in explaining the generation of the reference cosine and sine waves by the reference generator of FIG. 3.



FIG. 5 is a graph showing the generated reference sine and cosine waves as generated using the technique described with reference to FIG. 4.



FIG. 6 is a graph showing the spectra of the generated reference sine wave.



FIG. 7 contains graphs showing the output provided by the low-pass filter of FIG. 3 when the reference waves are generated by the reference generator as being sinusoidal, square, and triangular, for different sampling rates.



FIG. 8 is a graph showing the frequency response of the signal x(t) generated by the first demodulator of FIG. 3.



FIG. 9 is a graph showing the frequency response of the signal x(t) generated by the second demodulator of FIG. 3.



FIG. 10 is a graph illustrating the frequency response of a decimating SINC filter such as may be used for the low-pass filters of FIG. 3.



FIG. 11A is a graph showing the signals x(t) and y(t) generated by the demodulators of FIG. 3.



FIG. 11B is a graph showing the outputs X and Y of the filters of FIG. 3.



FIGS. 12A-12D are trigonometric circles used to describe the CORDIC technique used to recover the phase shift and amplitude values from the outputs X and Y of the filters of FIG. 3.





DETAILED DESCRIPTION

The following disclosure enables a person skilled in the art to make and use the subject matter disclosed herein. The general principles described herein may be applied to embodiments and applications other than those detailed above without departing from the spirit and scope of this disclosure. This disclosure is not intended to be limited to the embodiments shown, but is to be accorded the widest scope consistent with the principles and features disclosed or suggested herein.


Techniques to be described herein are based upon the combination of a digital lock-in amplifier approach with a numerical method to yield accurate estimations of the amplitude and phase of a sense signal obtained from a movement sensor associated with a resonant MEMS device such as a MEMS mirror. The techniques described herein are efficient from a computational point of view, in a manner which is suitable for applications in which the implementing hardware is to follow size and power consumption constraints.


First, the mathematical underpinnings of the techniques described herein will be discussed, and then the practical application and realization of those techniques will be discussed together with the uses thereof in real world applications to provide for accurate control of resonant MEMS mirrors using these techniques.


Illustrated in FIGS. 2A-2B is the digital lock-in amplifier approach. Shown in FIG. 2A are a digitized version of the sense signal as well as a reference signal, both at the same frequency. If these two signals are multiplied, the result is a signal with a mean value that is proportional to their amplitudes as well as the phase shift between the signals. Thus, notice that the result of this multiplication is equal to the two estimations (amplitude and phase of a sense signal) that it is desired to accurately and quickly perform. In the example of FIG. 2A, there is no phase shift between the sense signal and reference signal, so the mean value of the resulting wave can be calculated as:






M
e
a
n
=



A

s
e
n
s
e




A

r
e
f



2





Turn now to the example of FIG. 2B, where the sense signal and reference signal are in phase quadrature (e.g., phase shifted by 90°). Notice that in this example, the mean value of the product of the sense signal and reference signal is zero.


The mathematics yielding this result are now explained. The sense signal can be mathematically represented as:






s
e
n
s
e

t

=

A

s
e
n
s
e



sin



ω

s
e
n
s
e



t
+

φ

s
e
n
s
e








Here, Asense is the amplitude of the sense signal, ωsense is the frequency of the sense signal, and φsense is the phase of the sense signal.


The reference signal can be mathematically using the following two equations:






c
o

s

r
e
f



t

=

A

r
e
f



cos



ω

r
e
f



t
+

φ

r
e
f












s
i

n

r
e
f



t

=

A

r
e
f



sin



ω

r
e
f



t
+

φ

r
e
f








Here, Aref is the amplitude of the reference signal, ωref is the frequency of the reference signal, and φref is the phase of the reference signal.


The results of multiplication of the sense signal by the reference signal yields x and y values, which can be mathematically represented as:








y

t

=
s
e
n
s
e

t


c
o

s

r
e
f



t

=



A

r
e
f




A

s
e
n
s
e



2








sin


Δ
φ


+
sin


2

ω

r
e
f


t
+

φ

s
e
n
s
e


+

φ

r
e
f


















x

t

=
s
e
n
s
e

t


s
i

n

r
e
f



t

=



A

r
e
f




A

s
e
n
s
e



2








cos


Δ
φ


+
cos


2

ω

r
e
f


t
+

φ

s
e
n
s
e


+

φ

r
e
f












Here, Aref is the amplitude of the reference signal, Asense is the amplitude of the sense signal, ωref is the frequency of the reference signal, φsense is the phase of the sense signal, φref is the phase of the reference signal, and Δφ is the difference between φsense and φref.


Therefore, as can be seen, the result includes expressions proportional to amplitude, as well as the phase shift, and an intermodulation product (ωref ▪ t). The intermodulation product represents the oscillations seen in the product (demodulator output) shown in FIGS. 2A and 2B, and it is desired to remove these oscillations from the output.


Assuming that ωref = ωsense and that Aref = 1, the average of y(t), denoted Y, as obtained using suitable low-pass filtering can be mathematically represented as:






Y
=
<
y

t

>
=



A

s
e
n
s
e



2


sin


Δ
φ






Likewise assuming that ωref = ωsense and that Aref = 1, the average of x(t), denoted X, as obtained using suitable low-pass filtering can be mathematically represented as:






X
=
<
x

t

>
=



A

s
e
n
s
e



2


cos


Δ
φ






From this, using simple math, the amplitude of the sense signal can be recovered as:







A

s
e
n
s
e


=
2




X
2

+

Y
2







Similarly, the phase shift between the sense signal and reference signal can be recovered as:






Δ
φ
=


tan



1





Y
X







Hardware for use in implementing the estimation of the phase and amplitude of the sense signal, and then using that estimation in operating a laser scanning projector 100, is now described with additional reference to FIG. 3.


The laser scanning projector 100 includes a laser source 99 operated and driven by a laser driver 98 to emit a modulated laser beam at a resonant MEMS mirror 11 (e.g., micromirror). The MEMS mirror 11 is driven at resonance by a drive signal Drv generated by drive circuitry 12. A sensor 13, such as a piezoresistive based sensor, is used to generate a sense signal Sns in response to the movements of the MEMS mirror 11. A reference generator 97 generates reference signals for use by feedback circuitry 101. The feedback circuitry 101 receives the reference signals from the reference generator 97 and the sense signal Sns as input, and from them estimates the amplitude Asense of the sense signal and the phase shift Δφ of the sense signal.


A first error amplifier 22 compares the phase shift Δφ to a target phase shift φtarget to determine a phase error φerror. A phase controller 23 generates a new frequency setpoint to be used for tuning the driving frequency which may be generated from a fractional phase locked loop 24, in which case such tuning is achieved by changing the fractional input (PLLfrac). It is understood anyway that even though PLL circuitry is referred to herein, the driving frequency could also be generated by any controllable oscillator (such as a Voltage-Controlled Oscillator VCO).


The reference generator 97 receives the frequency signal Fdrive from the PLL 24 so that the frequency of the reference signals generated by the reference generator 97 matches the frequency of the drive signal Drv.


A second error amplifier 32 compares the amplitude Asense to an amplitude target Atarget to determine an amplitude error Aerror. An amplitude controller 33 generates a voltage signal Vdrive instruction the drive circuitry 12 at what amplitude to generate the drive signal Drv.


An analog to digital converter (ADC) 96 digitizes the sense signal Sns. The feedback circuitry 101 includes a first multiplication circuit 102 (e.g., a modulator) that receives the digitized sense signal Sns, which is mathematically represented as






s
e
n
s
e

t

=

A

s
e
n
s
e



sin



ω

s
e
n
s
e



t
+

φ

s
e
n
s
e








Here, with sense(t) and below with the following equations and expressions, since the operations are performed in the digital domain, t = nT, with T being the sampling period and n being the index of the nth sample. The first multiplication circuit 102 also receives a digital reference sine wave from the reference generator 97, which is mathematically represented as:







y

r
e
f


=
sin



ω

r
e
f



t
+

φ

r
e
f








The first multiplication circuit 12 multiplies these two signals to yield:








x

t

=
s
e
n
s
e

t


s
i

n

r
e
f



t

=


1


A

s
e
n
s
e



2








cos


Δ
φ



cos


2

ω

r
e
f


t
+

φ

s
e
n
s
e


+

φ

r
e
f












The expression x(t) is filtered by low-pass filter 103 within the feedback circuit 101 to produce X, mathematically represented as:






X
=
<
x

t

>
=



A

s
e
n
s
e



2


cos


Δ
φ






The feedback circuit 101 includes a second multiplication circuit 104 (e.g., a modulator) that receives the digitized sense signal sense(t), and also receives a digital reference cosine wave, the reference cosine wave being mathematically represented as:







x

r
e
f


=
cos



ω

r
e
f



t
+

φ

r
e
f








The second multiplication circuit 104 multiplies these two signals to yield:








y

t

=
s
e
n
s
e

t


c
o

s

r
e
f



t

=


1


A

s
e
n
s
e



2








sin


Δ
φ


+
sin


2

ω

r
e
f


t
+

φ

s
e
n
s
e


+

φ

r
e
f












The expression y(t) is filtered by low-pass filter 105 within the feedback circuit 101 to produce Y, mathematically represented as:






Y
=
<
y

t

>
=



A

s
e
n
s
e



2


sin


Δ
φ






X and Y are passed to an amplitude and phase estimation block 106 within the feedback circuit 101. The amplitude and phase estimation block 106 calculates the amplitude Asense and phase Δφ of the sense signal sense(t) as:







A

s
e
n
s
e


=
2




X
2

+

Y
2











Δ
φ
=


tan



1





Y
X







Generation of the reference signals xref and yref by the reference generator 97 is now described with initial reference to FIG. 4. Typically, when sinusoidal signals are generated, a summation approximation, such as the Taylor Series, may be used. However, these approximations are not precise enough for use in performing the techniques described herein. Furthermore, producing these approximations utilizes excessive processing power, which is particularly detrimental for applications where more limited processing capabilities are available. Indeed, using the Taylor series or polynomial approximations has too many drawbacks. As such, a new method for generating sinusoidal signals for use as reference signals has been developed. The new method relies upon trigonometric relationships to yield accurate results without the use of approximation, and precision being the function of fixed point implementations (e.g., no algorithmic error is introduced).


Referring to FIG. 4, a sine wave over time is depicted on a trigonometric circle. Starting from a generic point, here P0, there is an initial reference phase φref with respect to the x-axis, this initial phase being a use-defined entry such that this initial reference phase is chosen to suit the present application. Then, in the next iteration, there is point P1, then point P2, and so on, accomplished using a rotation of the vector. A rotation can be performed using trigonometric relationships, knowing the amount of rotation to be performed and the actual phase values at the current step. For example, assume there will be 16 samples of the sense signal Sns per mirror cycle, meaning that the output data rate (ODR) is 16, and that 16 data points for a reference sine wave are therefore to be generated so that the conditions of ωref = ωsense and Aref = 1 are fulfilled, enabling the calculation of x(t) and y(t) as described above to be performed.


The amount of rotation to be performed at each step can be calculated as:







φ

r
o
t


=


360
°


O
D
R


=


360
°


16


=
22.5
°




Therefore, knowing the amount of rotation per step and the initial phase-point P0 calculated as:







P
0




x
0

;

y
0



,








w
h
e
r
e


x
0

=
cos



φ

r
e
f




,

y
0

=
sin



φ

r
e
f








This allows the calculation of the phase shift at each rotation and its use to calculate the sine and cosine waves as:









φ

i
+
1


=





φ
i

+
Δ
φ







cos



φ

i
+
1




=
cos



φ
i




cos



φ

r
o
t





sin



φ
i




sin



φ

r
o
t










sin



φ

i
+
1




=
cos



φ
i




sin



φ

r
o
t




+
sin



φ
i




cos



φ

r
o
t










,










w
i
t
h

i

=

0
,



,

O
D
R

1.




It is to be understood that cos(φrot) = xrot and sin(φrot) = yrot, keeping in mind that φrot is known as being φrot = 360°/ODR, with ODR being 16 in this example. Therefore, using the known values of cos(φrot) and sin(φrot), and the known initial point P0(x0;y0), the data points used to form the sine and cosine waves shown in FIG. 5 can be determined. The advantage of this technique is that the generation of sine and cosine wave is performed without approximations and is performed simply (i.e. using only multiplicative terms which are already precalculated as xrot, yrot and the (x0;y0) = (cos(φref); sin(φref)). Therefore, the values of the reference cosine wave xref and reference sine wave yref, as used by the multiplication circuits 102 and 104 described above, have been determined through this technique, using simple and computationally un-intensive trigonometry, allowing the performance of the estimation techniques discussed above by fixed-point calculation hardware that does not consume much area. Stated another way, using this technique to calculate the values of the reference cosine wave and reference sine wave, the physical area of the circuitry required to generate the reference cosine and sine waves is reduced as compared to the prior art.


Additionally, the precision of this technique for calculating the values of the reference sine and cosine waves is high. Consider that if the output data rate ODR were to be infinite, there would be an infinite number of values produced for the reference cosine and sine waves, and therefore such waves would precisely mathematically match actual-continuous waves. On the other hand, if a prior art technique such as the Taylor series were to be used, such precision could never be achieved, as Taylor series always produces an approximation.


The spectrum of the generated reference sine wave may be observed in FIG. 6. Here, the frequency of the drive signal Drv (shown as Fref) is 20 kHz, and therefore the frequency of the reference sine wave is 20 kHz. However, harmonics occur due to the quantization of the reference sine wave, with the amplitude of the harmonics being dependent upon the number of bits available for the calculations The effect of these harmonics and how to handle them will be explained in detail later herein.


Shown in FIG. 7 is a comparison of the output of the low-pass filters 103 and 105 when using sinusoidal reference waves as compared to square or triangular reference waves for the case of ODR being 16, as well as for the case of ODR being 160. The theoretical scaling factor for the reference sine wave is Aref/2, for the square wave is 2·Aref/π, and for the triangular wave is 2·Aref/π2. As can be observed in FIG. 7, with a low sampling frequency (e.g., ODR=16), both the square wave and the triangular wave cannot be perfectly reproduced because they are not band-limited. As such, in the digital domain, all the infinite harmonics within the bandwidth cannot be included due to the Nyquist limit. Sine waves, on the other hand, are band-limited and so can be perfectly reproduced even when low sampling frequencies are available. The result of using either square or triangular wave as reference instead of sinusoids is that the scaling factor would be different than its theoretical value, with this effect being even more pronounced for the square wave since the harmonics decrease as 1/n for the square wave but 1/n2 for the triangular wave. This would ultimately lead to increased error in the estimation of the phase shift and amplitude of the sense signal Sns. Furthermore, if a square wave or triangular wave were used as the reference wave, harmonics carried by the sense signal Sns would also be demodulated, adding more information to the output that is not information about the fundamental components of the sense signal Sns. As such, the generation of reference sinusoidal waves is used herein.


Estimation of the phase Δφ by the feedback circuitry 101 is now described. As a reminder, the sense signal Sns can be mathematically represented as:






s
e
n
s
e

t

=

A

s
e
n
s
e



sin



ω

s
e
n
s
e



t
+

φ

s
e
n
s
e




+
O

S

s
e
n
s
e






Here, OSsense is the offset that might appear as an additive term in the sense signal Sns.


As explained above, the generation of the reference cosine and sine reference signals undesirably includes harmonics due to both quantization and limited ODR. As a result, for example, the cosine reference signal can be mathematically represented as:






c
o

s

r
e
f



t

=

c
o
s



ω

r
e
f



t
+

φ

r
e
f




+

A


r
e
f

c
o
s


2

ω

r
e
f



t
+


φ



r
e
f




+





Here, the A′ref ▪ cos(2ωref ▪ t + φ′ref) term and those following represent the harmonics present due to quantization. The calculation of y(t) then yields:






y

t

=
s
e
n
s
e

t


c
o

s

r
e
f



t









=



A

s
e
n
s
e



2




sin


Δ
φ


+
sin


2

ω

r
e
f


t
+

φ

s
e
n
s
e


+

φ

r
e
f






+




A



r
e
f




A

s
e
n
s
e



2











sin


3

ω

r
e
f


t
+

φ

s
e
n
s
e


+


φ



r
e
f




+
sin


3

ω

r
e
f


t
+

φ

s
e
n
s
e


+


φ



r
e
f






+









+


O

S

s
e
n
s
e



2


cos



ω

r
e
f


t
+

φ

r
e
f




+





This yields the desired fundamental components of the sense signal Sns, namely the









A

r
e
f



2





and sin(Δφ) terms, but also undesired intermodulation products (the other terms) that arise due to the difference between ωsense and ωref, 2ωref, etc.


Similarly, the sine reference signal can be mathematically represented as:






s
i

n

r
e
f



t

=
sin



ω

r
e
f



t
+

φ

r
e
f




+

A


r
e
f

sin



ω

r
e
f



t
+


φ



r
e
f




+





The calculation of x(t) then yields:






x

t

=
s
e
n
s
e

t




sin


r
e
f



t









=



A

s
e
n
s
e



2




cos


Δ
φ



cos


2

ω

r
e
f


t
+

φ

s
e
n
s
e


+

φ

r
e
f






+




A



r
e
f




A

s
e
n
s
e



2













cos


3

ω

r
e
f


t
+

φ

s
e
n
s
e


+

φ


r
e
f


+
cos



ω

r
e
f


t
+

φ

s
e
n
s
e


+


φ



r
e
f






+









+


O

S

s
e
n
s
e



2


sin



ω

r
e
f


t
+

φ

r
e
f




+





Here too, this yields the desired fundamental components of the sense signal Sns, namely the









A

r
e
f



2





and cos(Δφ) terms, but also undesired intermodulation products (the other terms) that arise due to the difference between ωsense and ωref, 2ωref, etc.


The results of the multiplications may be seen for the sample of the cosine reference wave in FIG. 8, where the desired data (that is the DC component) can be observed together with the intermodulation products (starting shortly before a frequency of 104 Hz), and for the sample of the sine reference wave in FIG. 9, wherein the desired data (again, the DC component) can be observed together with the intermodulation products (also starting shortly before a frequency of 104 Hz).


It is desired to cancel out these resulting intermodulation components in x(t) and (y). To do this, the low-pass filters 103 and 105 should have zeroes at harmonics in the reference signals, as shown in FIG. 10, to thereby filter out the intermodulation components. Since the reference sine and cosine signals are internally generated, their spectrum is known, and therefore the proper placement of the zeroes can easily be determined. For example, the zeroes are placed at ωref, 2ωref, 3ωref, etc., because those are the expected location of the harmonics given that ωref is known. The filters 103 and 105 may therefore be suitable ODR-decimation SINC filters.


The inputs x(t) and y(t) to the filters 103 and 105 can be observed in FIG. 11A, and the outputs of X and Y can be observed in FIG. 11B. After filtering, X thus becomes:






X
=
<
x

t

>
=



A

s
e
n
s
e



2


cos


Δ
φ






After filtering, Y thus becomes:






Y
=
<
y

t

>
=



A

s
e
n
s
e



2


sin


Δ
φ






From X and Y, Asense and Δφ can be recovered. This could be performed mathematically in the digital domain as:







A

s
e
n
s
e


=
2




X
2

+

Y
2



; and








Δ
φ
=


tan



1





Y
X







This would be easily performable in the case where the amplitude and phase estimation block 106 are implemented in a microprocessor. However, consider the case where the amplitude and phase estimation block 106 is to be implemented in a small application specific integrated circuit (ASIC) with low-power consumption and small area constraints, with poor computational abilities. In such a case, the above calculations of Asense and Δφ cannot be easily performed without modifying the constraints of the ASIC.


The implementation of the functions of the amplitude and phase estimation block 106 utilizing techniques easily performable by a small ASIC with low-power consumption and small area constraints is now described.


Consider the COordinate Rotation DIgital Computer (CORDIC) technique, a simple and efficient technique that can be used to calculate trigonometric functions, hyperbolic functions, square roots, multiplications, divisions, exponentials, and logarithms, using only computationally un-intensive subtraction and shift operations of the implementing ASIC. The starting point for the application of CORDIC to amplitude and phase estimation is the rotation matrix M, which is mathematically equivalent to X and Y described above, and can be represented as:






M
=






cos


Δ
φ







sin


Δ
φ








sin


Δ
φ






cos


Δ
φ












Starting from the rotation matrix M, factorization by cos (Δφ) can be performed to yield:






M
=
cos


Δ
φ







1




tan


Δ
φ








tan


Δ
φ





1









The idea is to achieve Δφ through successive approximations obtained by a linear combination of N precalculated angles θi, with the angles θi being chosen such that their tangent values are powers of 2, such that tan (θi) = 2-i. This reduces the matrix to a form where iterations can be calculated using shifts rather than multiplications.


Through this technique, Δφ is ultimately computed as:






Δ
φ





i
=
0


N

1




σ
i


θ
i

,






where σi is +1 or -1 depending upon the sign of the yi-1 component of the rotation vector at the previous iteration.


This would work well if:






Δ
φ





π
2

,

π
2







However, for a 4-quadrant application, modifications are to be made.


Refer now to the trigonometric circle shown in FIG. 12A, where a first point or vector P0 having the cosine, sine coordinates of (x0, y0) is shown, as is a second point or vector P1 having the cosine, sine coordinates of (x1, y1) is shown. These points are the output of the filters 103 and 105 at the beginning and after the first CORDIC iteration respectively - note that P0 is therefore calculated as











A

s
e
n
s
e



2

cos


Δ
φ


,



A

s
e
n
s
e



2

sin


Δ
φ




.




The angular distance between the vector P0 and the x-axis is the Δφ that it is desired to recover.


This is performed by successive approximation using the rotation matrix M. For example, for iteration i=1, P0 can be rotated by θ1 to reach P1, as shown in FIG. 12A. For the next iteration, i=2, P1 can be rotated by θ2 to reach P2, having the cosine, sine coordinates of (x2, y2), as shown in FIG. 12B. For the next iteration, i=3, P2 can be rotated by θ3 to reach P3, having the cosine, sine coordinates of (x3, y3), as shown in FIG. 12C. For the Nth and last iteration, i=N, PN is on the x-axis and has coordinates of (xn, 0).


This has been a series of approximated rotations by ±θi, ±θi+1, ±θi+2, ±θi+3, etc (with the actual signs of each rotation depending on the starting point as well as being decided at each iteration), up until the last point which will have approximately a 0 phase with an accuracy that depends on the number of iterations N (algorithmic error) and the fixed-point implementation. If these rotations are summed, the result will be a composition of angles that yield Δφ.


Thus, the technique has started with a vector that is Δφ degrees away from the x-axis, and at each iteration (±θi, ±θi+1, ±θi+2, ±θi+3, etc), the resulting phase becomes closer to 0. Thus, Δφ is approximated by summation of σiθi from 0 to N-1, with σi being +1 or -1 dependent upon the yi-1 component of the rotation vector at the previous iteration, and with θi being the rotation angle at each iteration. So, θi is the angle whose tangent is 2-i. Thus, Δφ is recomposed by as the series of smaller angles that when combined together with the appropriate sign, with the rotations being performed with the tangents of those angles, which are powers of 2 as explained. Therefore, this becomes multiplications by powers of 2, which are implemented as shifts, and shifts as explained above are efficient in terms of computational complexity and are capable of being performed by simple ASICS.


The successive approximation can be summed up as follows:

  • 1. The starting point is the X, Y coordinates from the outputs of the filters 103 and 105, mathematically represented as
  • Asense2cosΔφ,Asense2sinΔφ,
  • as explained above
  • 2. If X>=0, set Δθ=0 and go to the next step. Instead, If X<0, then if Y>0 set Δθ = +180, else set Δθ = -180. Also, rotate the starting X,Y coordinates by 180° by setting X=-X and Y=-Y.
  • 3. Start from Δθi from step 2., and repeat from i=0 to N-1:
  • If Y0,X=XYiY=Y+XiΔθ=Δθθi
  • If Y>0,X=X+YiY=YXiΔθ=Δθ+θi


The phase contributions of the partial angles Δθ are recorded in a lookup table. The lookup table is used together with the starting point X, Y and the described operations are performed at each iteration. After an infinite number of iterations, the phase will be exactly at 0. It has been found that 12 to 18 iterations provide sufficient accuracy for the laser scanning projector 100.


After the last iteration, Δφ and Asense are determined as:










Δ
φ

Δ
θ
,









A

s
e
n
s
e


=
K

X
,
where K depends on N and is known a priori as: 2









i
=
0


N

1



cos



θ
i















Using the above techniques, because the phase and amplitude (which is indicative of the opening angle of the MEMS mirror) are known upon commencement of operation, proper settings for Fdrive and Vdrive are quickly determined, making calibration quick and easy. Thus, in addition to reducing the computational complexity utilized for proper control of the MEMS mirror 11, lock time is decreased due to the quick determination of proper settings for Fdrive and Vdrive. Moreover, the amplitude and phase estimation are run in parallel and so are both control loops. Additionally, since the phase estimation is not limited by the resolution of the PLL counts, the above techniques are usable even with mirrors having a high resonance frequency, and in fact, are usable with any resonance MEMS device and are not limited to MEMS mirrors. Still further, the stability of the output provided here is more stable than would be provided by any analog control because analog lock-in amplifiers, though still implemented, suffer from technological and physical limitations (e.g., temperature deviation from the transistors used for demodulation, non-linearities, etc) which digital implementations are insensitive to. In addition the reference signal generation is reliable as it is based on using the same clock source as other components within the device.


The described functions and blocks of the feedback circuit 101 may be performed by a field programmable gate array (FPGA) or application specific integrated circuit (ASIC), for example.


Note that the above scheme permits precise control of the MEMS mirror 11 through the described hardware performing the described functions, and that the above scheme reduces the computational resources utilized to obtain precise control of the MEMS mirror 11 (e.g., reduces computational intensity of the functions performed that are used to precisely control the MEMS mirror 11).


Finally, it is clear that modifications and variations may be made to what has been described and illustrated herein, without thereby departing from the scope of this disclosure, as defined in the annexed claims.


While the disclosure has been described with respect to a limited number of embodiments, those skilled in the art, having benefit of this disclosure, will appreciate that other embodiments can be envisioned that do not depart from the scope of the disclosure as disclosed herein. Accordingly, the scope of the disclosure shall be limited only by the attached claims.

Claims
  • 1. A method of operating a micro-electro mechanical systems (MEMS) device, comprising: driving the MEMS device with a drive signal;sensing movement of the MEMS device caused by the drive signal, and generating a sense signal indicative of the movement;using a rotation-matrix approach to generate a reference cosine wave and a reference sine wave, the reference cosine wave and reference sine wave each having an amplitude of 1 and a same frequency as that of the sense signal;multiplying the sense signal by the reference sine wave to produce a first product;multiplying the sense signal by the reference cosine wave to produce a second product;low-pass filtering the first product to produce a first intermediate output;low-pass filtering the second product to produce a second intermediate output;performing a 4-quadrant CORDIC technique on the first and second intermediate outputs to thereby determine a phase shift between the sense signal and the drive signal as well as an amplitude of the sense signal;comparing the phase shift to a target phase shift to produce a phase error as a difference therebetween;comparing the amplitude of the sense signal to a target amplitude to thereby produce an amplitude error as a difference therebetween; andmodifying the drive signal based upon the phase error and the amplitude error so that the phase error and amplitude error are eliminated.
  • 2. The method of claim 1, further comprising digitizing the sense signal prior to multiplication by the reference sine and cosine waves; and wherein the reference sine and cosine waves are generated in digital form.
  • 3. The method of claim 1, wherein the low-pass filtering of the first product serves to remove intermodulation components from the reference sine wave; and wherein the low-pass filtering of the second product serves to remove intermodulation components from the reference cosine wave.
  • 4. The method of claim 1, wherein the low-pass filtering of the first product is performed using a first decimation SINC filter; and wherein the low-pass filtering of the second product is performed using a second decimation SINC filter.
  • 5. The method of claim 1, wherein performing the 4-quadrant CORDIC technique comprises: a) defining an index i having integer values ranging from 0 to N-1, with N being the total amount of CORDIC iterations;b) precalculating N angles θi such that for each of the N angles, tan (θi) = 2-i;c) determining a starting coordinate set X0, Y0 from the two SINC outputs (i.e. Y and X);d) If X>=0, setting Δθ=0 as a starting point, else if X<0, then if Y>0 setting Δθ = +180, else setting Δθ = -180. Also, rotating the starting X,Y coordinates by 180° by setting X=-X and Y=-Y;e) for a first number i=0 in the index, setting a next coordinate set X1, Y1 to be such that X1=X0-(Y0 >> 0) and Y1=Y0+(X0 >> 0) and determine a phase Δθ = Δθ - θi if Y0 ≤ 0, but setting the next coordinate set X1,Y1 to be such that X1=X0+(Y0 >>0) and Y1=Y0-(X0 >>0)and determine the phase Δθ = Δθ + θi, if Y0 > 0;f) incrementing i by one;g) for an ith number i in the index, setting a next coordinate set Xi, Yi to be such that Xi+1=Xi-(Yi >> i) and Yi+1=Yi+(Xi >> i) and determine a phase Δθ = Δθ - θi if Yi ≤ 0, but setting the next coordinate set Xi+1,Yi+1 to be such that Xi+i=Xi+(Yi >>i) and Yi+1=Yi-(Xi >>i)and determine the phase Δθ = Δθ + θi, if Yi > 0;h) if i<N-1, return to f); andi) if i=N-1: determine the phase shift as being equal to the phase Δθ anddetermine the amplitude of the sense signal as being equal to K·XN-1, beingK=2⋅∏i=0N−1cosθi .
  • 6. The method of claim 1, wherein the rotation-matrix approach is performed by: a) defining an index i having integer values ranging from 0 to N-1, with N being the number of samples per reference cycle;b) determining a rotation amount as being equal to 360°/N and precalculating the (x_rot; y_rot)=(cos(360/N); sin(360/N)) rotation coordinates;c) determining a starting coordinate set X0, Y0 where x0 = cos (φref), y0 = sin (φref), with φref being equal to the initial phase shift for the reference waves;d) rotating the start coordinate set X0, Y0 by the rotation amount to produce a next coordinate set X1, Y1as X1 = X0 ▪ xrot - Y0 ▪ yrot and Y1 = X0 ▪ yrot + Y0 ▪ xrot;e) incrementing i by 1;f) rotate the coordinate set X1, Y1 by the rotation amount to produce an ith coordinate set Xi, Yi as Xi+1 = Xi ▪ xrot - Yi ▪ yrot and Yi+1 = Xi ▪ yrot + Yi ▪ xrot;g) if i<N-1, return to e); andh) if i=N-1, reset the index to 0, and start over from c).
  • 7. A system for driving micro-electro mechanical systems (MEMS) device, the system comprising: a driver generating a drive signal for the MEMS device;a sensor associated with the MEMS device and generating an output indicative of movement of the MEMS device;an analog to digital converter digitizing the output of the sensor to produce a sense signal indicative of movement of the MEMS device;a reference generator using a rotation-matrix approach to generate a reference cosine wave and a reference sine wave based upon a frequency drive signal, the reference cosine wave and reference sine wave each having an amplitude of 1 and a same frequency as that of the sense signal;a processing circuit configured to: multiply the sense signal by the reference sine wave to produce a first product;multiply the sense signal by the reference cosine wave to produce a second product;low-pass filter the first product to produce a first intermediate output;low-pass filter the second product to produce a second intermediate output; andperform a 4-quadrant CORDIC technique on the first and second intermediate outputs to thereby determine a phase shift between the sense signal and the drive signal as well as an amplitude of the sense signal;a first error amplifier comparing the amplitude of the sense signal to a target amplitude to thereby produce an amplitude error as a difference therebetween;a second error amplifier comparing the phase shift to a target phase shift to produce a phase error as a difference therebetween; andcontroller circuitry causing modifying of the drive signal based upon the phase error and the amplitude error so that the phase error and amplitude error are eliminated.
  • 8. The system of claim 7, wherein the controller circuitry comprises: a phase controller generating a control signal based upon the phase error;a programmable oscillator, generating the frequency drive signal based upon the control signal, the driver modifying phase of the drive signal based upon the frequency drive signal such that the phase error is eliminated; andan amplitude controller generating a voltage drive signal to the driver based upon the amplitude error, the driver modifying amplitude of the drive signal based upon the voltage drive signal such that the amplitude error is eliminated.
  • 9. The system of claim 8, wherein the programmable oscillator comprises a phase locked loop (PLL).
  • 10. The system of claim 7, wherein the processing circuit is an application specific integrated circuit (ASIC).
  • 11. The system of claim 7, wherein the low-pass filtering of the first product performed by the processing circuit serves to remove intermodulation components from the reference sine wave; and wherein the low-pass filtering of the second product performed by the processing circuit serves to remove intermodulation components from the reference cosine wave.
  • 12. The system of claim 7, wherein the low-pass filtering of the first product is performed by the processing circuit using a first decimation SINC filter; and wherein the low-pass filtering of the second product is performed by the processing circuit using a second decimation SINC filter.
  • 13. The system of claim 7, wherein the processing circuit performs the 4-quadrant CORDIC technique by: a) defining an index i having integer values ranging from 0 to N-1, with N being the total amount of CORDIC iterations;b) precalculating N angles θi such that for each of the N angles, tan (θi) = 2-i;c) determining a starting coordinate set X0, Y0 from the two SINC outputs (i.e. Y and X);d) If X>=0, setting Δθ=0 as a starting point, else if X<0, then if Y>0 setting Δθ = +180, else setting Δθ = -180. Also, rotating the starting X,Y coordinates by 180° by setting X=-X and Y=-Y;e) for a first number i=0 in the index, setting a next coordinate set X1, Y1 to be such that X1=X0-(Y0 >> 0) and Y1=Y0+(X0 >> 0) and determine a phase Δθ = Δθ - θi if Y0 ≤ 0, but setting the next coordinate set X1,Y1 to be such that X1=X0+(Y0 >> 0) and Y1=Y0-(X0 >>0)and determine the phase Δθ = Δθ + θi, if Y0 > 0;f) incrementing i by one;g) for an ith number i in the index, setting a next coordinate set Xi, Yi to be such that Xi+1=Xi-(Yi >> i) and Yi+1=Yi+(Xi >> i) and determine a phase Δθ = Δθ - θi if Yi ≤ 0, but setting the next coordinate set Xi+1,Yi+1 to be such that Xi+1=Xi+(Yi >>i) and Yi+1=Yi-(Xi >>i)and determine the phase Δθ = Δθ + θi, if Yi > 0;h) if i<N-1, return to f); andi) if i=N-1: determine the phase shift as being equal to the phase Δθ anddetermine the amplitude of the sense signal as being equal to K·XN-1, beingK=2⋅∏i=0N−1cosθi .
  • 14. The system of claim 7, wherein the processing circuit performs the rotation-matrix by: a) defining an index i having integer values ranging from 0 to N-1, with N being the number of samples per reference cycle;b) determining a rotation amount as being equal to 360°/N and precalculating the (x_rot; y_rot)=(cos(360/N); sin(360/N)) rotation coordinates;c) determining a starting coordinate set X0, Y0, where x0 = cos (φref), y0 = sin (φref), with φref being equal to theinitial phase shift for the reference waves;d) rotating the start coordinate set X0, Y0 by the rotation amount to produce a next coordinate set X1, Y1as X1 = X0 ▪ xrot - Y0 ▪ yrot and Y1 = X0 ▪ yrot + Y0 ▪ xrot;e) incrementing i by 1;f) rotate the coordinate set X1, Y1 by the rotation amount to produce an ith coordinate set Xi, Yi as Xi+1 = Xi ▪ xrot - Yi ▪ yrot and Yi+1 = Xi ▪ yrot + Yi ▪ xrot;g) if i<N-1, return to e); andh) if i=N-1, reset the index to 0, and start over from c).
  • 15. A method of operating a micro-electro mechanical systems (MEMS) device, comprising: generating a reference cosine wave and a reference sine wave, the reference cosine wave and reference sine wave each having an amplitude of 1 and a same frequency as that of a sense signal indicative of movement of the MEMS device;multiplying the sense signal by the reference sine wave to produce a first product;multiplying the sense signal by the reference cosine wave to produce a second product;filtering the first product to produce a first intermediate output;filtering the second product to produce a second intermediate output; andperforming a technique on the first and second intermediate outputs to thereby determine a phase shift between the sense signal and the drive signal as well as an amplitude of the sense signal;comparing the phase shift to a target phase shift to produce a phase error as a difference therebetween;comparing the amplitude of the sense signal to a target amplitude to thereby produce an amplitude error as a difference therebetween; andmodifying a drive signal for the MEMS device based upon the phase error and the amplitude error so that the phase error and amplitude error are eliminated.
  • 16. The method of claim 15, further comprising digitizing the sense signal prior to multiplication by the reference sine and cosine waves; and wherein the reference sine and cosine waves are generated in digital form.
  • 17. The method of claim 15, wherein the filtering of the first product serves to remove intermodulation components from the reference sine wave; and wherein the filtering of the second product serves to remove intermodulation components from the reference cosine wave.
  • 18. The method of claim 15, wherein the filtering of the first product is performed using a first decimation filter; and wherein the filtering of the second product is performed using a second decimation filter.