# Patent

## Title
Magnetic field sensor and related techniques that provide an angle correction module

## Abstract

A magnetic field sensor provides an angle error value to correct errors of the magnetic field sensor. The angle error value is a function of temperature and magnetic field strength and is used to correct a measured magnetic field angle. Associated methods are also described.

## Background
CROSS REFERENCE TO RELATED APPLICATIONS
Not Applicable.
STATEMENT REGARDING FEDERALLY SPONSORED RESEARCH
Not Applicable.
FIELD
This invention relates generally to magnetic field sensors and, more particularly, to a magnetic field sensor that can provide an output signal representative of a magnetic field, for which angular errors are reduced.
BACKGROUND
Magnetic field sensing elements can be used in a variety of applications. In one application, a magnetic field sensing element can be used to detect a direction of a magnetic field, i.e., and angle of the direction of the magnetic field.
Planar Hall elements and vertical Hall elements are known types of magnetic field sensing elements. A planar Hall element tends to be responsive to magnetic field perpendicular to a surface of a substrate on which the planar Hall element is formed. A vertical Hall element tends to be responsive to magnetic field parallel to a surface of a substrate on which the vertical Hall element is formed.
Other types of magnetic field sensing elements are known. For example, a so-called “circular vertical Hall” (CVH) sensing element, which includes a plurality of vertical Hall elements, is known and described in PCT Patent Application No. PCT/EP2008/056517, entitled “Magnetic Field Sensor for Measuring Direction of a Magnetic Field in a Plane,” filed May 28, 2008, and published in the English language as PCT Publication No. WO 2008/145662, which application and publication thereof are incorporated by reference herein in their entirety. The CVH sensing element is a circular arrangement of vertical Hall elements arranged over a common circular implant and diffusion region in a substrate. The common implant and diffusion region can be a common epi (epitaxial) region (e.g., layer) upon a substrate, bounded by semiconductor isolation structures. The CVH sensing element can be used to sense a direction (i.e., an angle) (and optionally a strength) of a magnetic field in a plane of the substrate.
Various parameters characterize the performance of magnetic field sensing elements and magnetic field sensors that use magnetic field sensing elements. These parameters include sensitivity, which is a change in an output signal of a magnetic field sensing element in response to a change of magnetic field experienced by the magnetic sensing element, and linearity, which is a degree to which the output signal of the magnetic field sensing element varies in direct proportion to the magnetic field. These parameters also include an offset, which is characterized by an output signal from the magnetic field sensing element not representative of a zero magnetic field when the magnetic field sensing element experiences a zero magnetic field.
The above-described CVH sensing element is operable, with associated circuits, to provide an output signal representative of an angle of a direction of a magnetic field. Therefore, as described below, if a magnet is disposed upon or otherwise coupled to a so-called “target object,” for example, a camshaft in an engine, the CVH sensing element can be used to provide an output signal representative of an angle of rotation of the target object.
The CVH sensing element is but one element that can provide an output signal representative of an angle of a magnetic field, i.e., an angle sensor. For example, an angle sensor can be provided from a plurality of separate vertical Hall elements or a plurality of magnetoresistance elements. Collectively, magnetic field sensing element(s) that generate an output signal related to an angle of a magnetic field are referred to herein “angle sensing elements.”
More parameters can characterize the performance of angle sensing element(s), e.g., a CVH sensing element. One such parameter is an angular accuracy of the output signal generated by the angle sensing element(s). Angular accuracy can have both an average angle error that is the same at all magnetic field pointing angles, and also an angle error that is different at different magnetic field angles (i.e. a non-linearity error). Another parameter is the speed with which the angle sensing element(s) can convey the angle of the magnetic field. It will be understood that the speed is particularly important for applications in which the angle of the magnetic field may be rapidly changing. Some parameters that can characterize an angle sensing element tend to change with temperature.
SUMMARY
The present invention provides circuits and techniques that can process output signals from an angle sensing element to provide an output signal that has a high degree of angle accuracy. In accordance with one aspect of the present invention, a magnetic field sensor includes a plurality of magnetic field sensing elements, each configured to generate a respective x-y output signal responsive to a magnetic field in an x-y plane, an angle processing circuit coupled to receive the x-y output signals and configured to generate an uncorrected x-y angle value representative of an angle of the magnetic field in an x-y plane and comprising a first angle error, a temperature sensor configured to generate a temperature signal representative of a temperature, an angle error correction module coupled to the angle processing circuit and the temperature sensor and configured to generate, in response to a measured magnetic field signal and the temperature signal, an x-y angle error value indicative of an error in the uncorrected x-y angle value, and a combining module configured to combine the uncorrected x-y angle value with the x-y angle error value to generate a corrected x-y angle value having a second angle error smaller than the first angle error.
The plurality of magnetic field sensing elements may comprise a plurality of vertical Hall Effect elements arranged as a circular vertical Hall (CVH) element and configured to generate a respective plurality of x-y output signals having a direction component in an x-y plane. The sensor may include bandpass filter responsive to the plurality of x-y output signals to generate the measured magnetic field signal. A sine lookup table may be provided for storing a plurality of sine values and the angle error correction module is coupled to receive a sine value selected from among the plurality of sine values and to generate the x-y angle error value additionally in response to the selected sine value. The selected sine value may be selected in accordance with the uncorrected x-y angle value.
A coefficient table may be configured to store a plurality of correction coefficients for use by the angle error correction module. The plurality of correction coefficients may comprise a plurality of magnitudes and phases of one or more harmonics of the first angle error, such as first and second harmonics of the first angle error in one embodiment. The plurality of correction coefficients may further comprise an average component of the first angle error.
In accordance with another aspect of the present invention, a method of reducing an error in a magnetic field sensor includes providing a plurality of magnetic field sensing elements, each configured to generate a respective x-y output signal responsive to a magnetic field in an x-y plane, using the x-y output signals to generate an uncorrected x-y angle value representative of an angle of the magnetic field in an x-y plane and having a first angle error, measuring a temperature to generate a temperature signal, and correcting the uncorrected x-y angle value as a function of a measured magnetic field signal and the temperature signal to provide a corrected x-y angle value having a second angle error smaller than the first angle error.
The magnetic field sensing elements may comprises a plurality of vertical Hall Effect elements arranged as a circular vertical Hall (CVH) element configured to generate a respective plurality of x-y output signals responsive to a magnetic field having a direction component in an x-y plane. The method may further include filtering the plurality of x-y output signals to provide the measured magnetic field signal. Correcting the uncorrected x-y angle value may include storing a plurality of correction coefficients, using an error correction module to generate an x-y angle error value in response to the correction coefficients, and combining the uncorrected x-y angle value with the x-y angle error value to generate the corrected x-y angle value. A plurality of sine values may be stored and using the error correction module may further comprise selecting a sine value from among the plurality of sine values in accordance with the uncorrected x-y angle value.
Storing the plurality of correction coefficients may comprise storing respective magnitudes and phases of one or more harmonics of the first angle error, such as first and second harmonics of the first angle error. Storing the plurality of correction coefficients may further comprise storing an average component of the first angle error.



BRIEF DESCRIPTION OF THE DRAWINGS
The foregoing features of the invention, as well as the invention itself may be more fully understood from the following detailed description of the drawings, in which:
FIG. 1 is a pictorial showing a circular vertical Hall (CVH) sensing element having a plurality of vertical Hall elements arranged in a circle over a common implant region upon a substrate, and a two pole magnet disposed close to the CVH sensing element;
FIG. 1A is pictorial showing a plurality of magnetic field sensing elements;
FIG. 2 is a graph showing an output signal as may be generated by the CVH sensing element of FIG. 1 or by the plurality of magnetic field sensing elements of FIG. 1A;
FIG. 3 is a block diagram of an exemplary magnetic field sensor having a CVH sensing element, having a current spinning sequence selection module configured to provide current spinning of vertical Hall elements within the CVH sensing element with variations of current spinning phase sequences, and also having an angle error correction module configured to estimate an angle error value that can be applied to reduce an angular error;
FIGS. 4-4C are block diagrams showing a vertical Hall element of the CVH sensing element of FIG. 3 when coupled into four current spinning phases, each phase associated with operation of one of the vertical Hall elements of the CVH sensing element of FIG. 3;
FIG. 5 is a graph showing ideal and non-ideal operation of the magnetic field sensor of FIG. 3;
FIG. 6 is a flow diagram illustrating a method for correcting a measured magnetic field angle based on magnetic field strength and temperature;
FIG. 6A is a flow diagram illustrating a method for measurement of the magnetic field strength in FIG. 6;
FIG. 6B is a flow diagram illustrating a method for measurement of the temperature in FIG. 6;
FIG. 6C is a flow diagram illustrating a method for correcting a measured magnetic field angle utilizing the methods of FIGS. 6A and 6B;
FIG. 7 is a block diagram of a magnetic field sensor that has but one planar Hall element, and that has a current spinning/filter control module to control current spinning phases;
FIG. 8 is a graph showing a frequency domain of operation of the magnetic field sensor of FIG. 7, when operated with repeating current spinning phase sequences; and
FIG. 9 is a graph showing a frequency domain of operation of the magnetic field sensor of FIG. 7 when operated with varying current spinning phase sequences.



DETAILED DESCRIPTION
As used herein, the term “magnetic field sensing element” is used to describe a variety of electronic elements that can sense a magnetic field. The magnetic field sensing element can be, but is not limited to, a Hall Effect element, a magnetoresistance element, or a magnetotransistor. As is known, there are different types of Hall Effect elements, for example, a planar Hall element, a vertical Hall element, and a circular vertical Hall (CVH) element. As is also known, there are different types of magnetoresistance elements, for example, a semiconductor magnetoresistance element such as Indium Antimonide (InSb), a giant magnetoresistance (GMR) element, an anisotropic magnetoresistance element (AMR), a tunneling magnetoresistance (TMR) element, and a magnetic tunnel junction (MTJ). The magnetic field sensing element may be a single element or, alternatively, may include two or more magnetic field sensing elements arranged in various configurations, e.g., a half bridge or full (Wheatstone) bridge. Depending on the device type and other application requirements, the magnetic field sensing element may be a device made of a type IV semiconductor material such as Silicon (Si) or Germanium (Ge), or a compound, e.g., type III-V, semiconductor material like Gallium-Arsenide (GaAs) or an Indium compound, e.g., Indium-Antimonide (InSb).
As is known, some of the above-described magnetic field sensing elements tend to have an axis of maximum sensitivity parallel to a substrate that supports the magnetic field sensing element, and others of the above-described magnetic field sensing elements tend to have an axis of maximum sensitivity perpendicular to a substrate that supports the magnetic field sensing element. In particular, planar Hall elements tend to have axes of sensitivity perpendicular to a substrate, while metal based or metallic magnetoresistance elements (e.g., GMR, TMR, AMR) and vertical Hall elements tend to have axes of sensitivity parallel to a substrate.
As used herein, the term “magnetic field sensor” is used to describe a circuit that uses a magnetic field sensing element, generally in combination with other circuits. Magnetic field sensors are used in a variety of applications, including, but not limited to, an angle sensor that senses an angle of a direction of a magnetic field, a current sensor that senses a magnetic field generated by a current carried by a current-carrying conductor, a magnetic switch that senses the proximity of a ferromagnetic object, a rotation detector that senses passing ferromagnetic articles, for example, magnetic domains of a ring magnet or a ferromagnetic target (e.g., gear teeth) where the magnetic field sensor is used in combination with a back-biased or other magnet, and a magnetic field sensor that senses a magnetic field density of a magnetic field.
While a circular vertical Hall (CVH) element, which has a plurality of vertical Hall elements, is described in examples below, it should be appreciated that the same or similar techniques and circuits apply to any type of magnetic field sensing element(s) arranged in a manner to detect an angle of a pointing direction of a magnetic field, e.g., a rotation angle of a target object to which a magnet is attached.
Referring to FIG. 1, a circular vertical Hall (CVH) element 12 includes a circular implant and diffusion region 18 in a substrate (not shown). The CVH sensing element 12 has a plurality of vertical Hall elements, of which a vertical Hall element 12a is but one example. In some embodiments, the common implant and diffusion region 18 can be characterized as a common epitaxial region upon a substrate, bounded by semiconductor isolation structures.
Each vertical Hall element has a plurality of Hall element contacts (e.g., four or five contacts), e.g., 12aa. Each vertical Hall element contact can be comprised of a metal contact over a contact diffusion region (a pickup) diffused into the common implant and diffusion region 18.
A particular vertical Hall element (e.g., 12a) within the CVH sensing element 12, which, for example, can have five adjacent contacts, can share some, for example, four, of the five contacts with a next vertical Hall element (e.g., 12b). Thus, a next vertical Hall element can be shifted by one contact from a prior vertical Hall element. For such shifts by one contact, it will be understood that the number of vertical Hall elements is equal to the number of vertical Hall element contacts, e.g., 32 or 64. However, it will also be understood that a next vertical Hall element can be shifted by more than one contact from the prior vertical Hall element, in which case, there are fewer vertical Hall elements than there are vertical Hall element contacts in the CVH sensing element.
As shown, a center of a vertical Hall element 0 can positioned along an x-axis 20 and a center of vertical Hall element 8 can be positioned along a y-axis 22. In the exemplary CVH sensing element 12, there are thirty-two vertical Hall elements and thirty-two vertical Hall element contacts. However, a CVH can have more than or fewer than thirty-two vertical Hall elements and more than or fewer than thirty-two vertical Hall element contacts.
In some applications, a circular magnet 14 having a north side 14b and a south side 14a can be disposed over the CVH 12. The circular magnet 14 tends to generate a magnetic field 16 having a direction from the north side 14b to the south side 14a, here shown to be pointed to a direction of about forty-five degrees relative to x-axis 20.
In some applications, the circular magnet 14 is mechanically coupled to a rotating target object, for example, an automobile steering shaft of an automobile camshaft, and is subject to rotation relative to the CVH sensing element 12. With this arrangement, the CVH sensing element 12, in combination with an electronic circuit described below, can generate a signal related to the angle of rotation of the magnet 14, i.e., an angle of rotation of the target object to which the magnet is coupled.
Referring now to FIG. 1A, a plurality of magnetic field sensing elements 30a-30h, in a general case, can be any type of magnetic field sensing elements. The magnetic field sensing elements 30a-30h can be, for example, separate vertical Hall elements or separate magnetoresistance elements, each having an axis of maximum response parallel to a surface of a substrate 34. These magnetic field sensing elements can be coupled to an electronic circuit the same as or similar to electronic circuits described below in conjunction with FIGS. 3 and 6. There can also be a magnet the same as or similar to the magnet 14 of FIG. 1 disposed proximate to the magnetic field sensing elements 30a-30h. 
Referring now to FIG. 2, a graph 50 has a horizontal axis with a scale in units of CVH vertical Hall element position, n, around a CVH sensing element, for example, the CVH sensing element 12 of FIG. 1. The graph 50 also has a vertical axis with a scale in amplitude in units of millivolts. The vertical axis is representative of output signal levels from the plurality of vertical Hall elements of the CVH sensing element taken sequentially, one at a time, about the ring of contacts of the CVH sensing element.
The graph 50 includes a signal 52 representative of output signal levels from the plurality of vertical Hall elements of the CVH taken with the magnetic field of FIG. 1 pointing in a direction of forty-five degrees.
Referring briefly to FIG. 1, as described above, vertical Hall element 0 is centered along the x-axis 20 and vertical Hall element 8 is centered along the y-axis 22. In the exemplary CVH sensing element 12, there are thirty-two vertical Hall element contacts and a corresponding thirty-two vertical Hall elements, each vertical Hall element having a plurality of vertical Hall element contacts, for example, five contacts. In other embodiments, there are sixty-four vertical Hall element contacts and a corresponding sixty-four vertical Hall elements.
In FIG. 2, for the magnetic field 16 of FIG. 1 pointing at positive forty-five degrees, a maximum positive signal is achieved from a vertical Hall element centered at position 4, which is aligned with the magnetic field 16 of FIG. 1, such that a line drawn between the vertical Hall element contacts (e.g., five contacts) of the vertical Hall element at position 4 is perpendicular to the magnetic field. A maximum negative signal is achieved from a vertical Hall element centered at position 20, which is also aligned with the magnetic field 16 of FIG. 1, such that a line drawn between the vertical Hall element contacts (e.g., five contacts) of the vertical Hall element at position 20 is also perpendicular to the magnetic field.
A sine wave 54 is provided to more clearly show ideal behavior of the signal 52. The signal 52 has variations due to vertical Hall element offsets, which tend to cause corresponding variations of output signals causing them to be too high or too low relative to the sine wave 54, in accordance with offset errors for each element. The offset signal errors are undesirable.
Full operation of the CVH sensing element 12 of FIG. 1 and generation of the signal 52 of FIG. 2 are described in more detail in the above-described PCT Patent Application No. PCT/EP2008/056517, entitled “Magnetic Field Sensor for Measuring Direction of a Magnetic Field in a Plane,” filed May 28, 2008, which is published in the English language as PCT Publication No. WO 2008/145662.
Groups of contacts of each vertical Hall element can be used in a chopped arrangement (also referred to herein as current spinning) to generate chopped output signals from each vertical Hall element. Thereafter, a new group of adjacent vertical Hall element contacts can be selected (i.e., a new vertical Hall element), which can be offset by one element from the prior group. The new group can be used in the chopped arrangement to generate another chopped output signal from the next group, and so on.
Each step of the signal 52 is representative of an unchopped output signal, i.e., from one respective group of vertical Hall element contacts, i.e., from one respective vertical Hall element. Thus, for a CVH sensing element having 32 vertical Hall elements taken sequentially, there are thirty-two steps in the signal 52 when current spinning is not used. However, for embodiments in which current spinning is used, each step of the signal 52 can be comprised of several sub-steps (not shown, e.g., four sub-steps), each sub-step indicative of a current spinning “phase.”
Current spinning and current spinning phases are described more fully below in conjunction with FIGS. 4-4C.
It will be understood that a phase of the signal 52 is related to an angle of the magnetic field 16 of FIG. 1 relative to position zero of the CVH sensing element 12. It will also be understood that a peak amplitude of the signal 52 is generally representative of a strength of the magnetic field 16. Using electronic circuit techniques described above in PCI Patent Application No, PCT/EP2008/056517, or using other techniques described below, a phase of the signal 52 (e.g., a phase of the signal 54) can be found and can be used to identify the pointing direction of the magnetic field 16 of FIG. 1 relative to the CVH sensing element 12.
Referring now to FIG. 3, a magnetic field sensor 100 includes a CVH sensing element 102 having a plurality of vertical Hall elements, each vertical Hall element comprising a group of vertical Hall element contacts (e.g., five vertical Hall element contacts). In some embodiments, the CVH sensing element 102 can be the same as or similar to the CVH sensing element 12 described above in conjunction with FIG. 1, and can be disposed proximate to a two pole magnet 144 coupled to a target object 146, which magnet 144 can be the same as or similar to the magnet 14 of FIG. 1. However, in some embodiments, the CVH sensing element 102 can be replaced by a group of magnetic field sensing elements the same as or similar to those described above in conjunction with FIG. 1A.
The CVH sensing element 102 can be coupled to sequence switches 104 that sequence through the vertical Hall elements of the CVH sensing element 102 to provide an output signal 104a, which can be the same as or similar to the sequenced signal 52 of FIG. 2.
The CVH sensing element 102 can also be coupled to current spinning switches 105, which can be coupled to the CVH sensing element 102 via the sequence switches 104.
Current sources 103 can be configured to generate one or more current signals 103a. The current spinning switches 105 can be coupled to receive the one or more current signals 103a and to provide the current signals as signals 104b to the selected vertical Hall elements within the CVH sensing element 102.
As described above, current spinning, also referred to as chopping, is a process by which current sources, e.g., current sources 103, are sequentially coupled to different selected nodes of a selected vertical Hall element (selected via the sequence switches 104) within the CVH sensing element 102 using the current spinning switches 105. At the same time, and synchronously, the current spinning switches 105 provide couplings to selected output nodes of the selected vertical Hall element in accordance with so-called current spinning phase. Current spinning is further described below in conjunction with FIGS. 4-4D.
A current spinning sequence selection module 119 can generate a current spinning sequence control signal 119a received by an oscillator and logic module 120. The oscillator and logic module 120 can be coupled to provide a control signal 120b to the current spinning switches 105 to control current spinning phase sequences of selected ones of the vertical Hall elements of the CVH sensing element 102. The oscillator and logic 120 can also be coupled provide a control signal 120a to the sequence switches 104, to provide sequential selections of the vertical Hall elements within the CVH sensing element 102 and to provide the sequential output signal 104a from the vertical Hall elements of the CVH sensing element 102 in accordance with the selection.
In some embodiments, current spinning is not used.
An amplifier 108 can be coupled to receive the signal 105a and configured to generate an amplified signal 108a. An analog-to-digital converter 112 can be coupled to receive the amplified signal 108a and configured to generate a converted signal 112a, a digital signal. A bandpass filter 110 can be coupled to receive the converted signal 112a and configured to generate a filtered signal 110a. The filtered signal 110a is indicative of the measured magnetic field strength, B. An angle calculation module 118 can be coupled to receive the filtered signal 110a and configured to generate an uncorrected x-y angle value, θ, 118a indicative of the angle of the magnetic field generated by the magnet 144, but with angle error more fully described below.
The angle calculation module 118 can also be coupled to receive clock signals 120c, 120d from the oscillator and logic module 120. The clock signal 120d can be a high speed clock signal.
In operation, the uncorrected x-y angle value 118a can have a first angle error. The first angle error is described more fully below in conjunction with FIG. 5. Let it suffice here to say that the first angle error is an angle error that causes the uncorrected x-y angle value 118a to not be perfectly representative of the true angle of the magnetic field generated by the magnet 144.
An angle error correction module 138 is coupled to receive the uncorrected x-y angle value 118a and the magnetic field strength signal 110a and configured to generate an angle error value, ê, 138a indicative of the first angle error within the uncorrected x-y angle value 118a. A combining module 126, here shown to be a summing node, can be coupled to receive the uncorrected x-y angle value 118a, coupled to receive the angle error value 138a, and configured to generate a corrected x-y angle value 126a. The corrected x-y angle value 126a can have a second angle error that is smaller than the first angle error of the uncorrected x-y angle value 118a. Thus, the corrected x-y angle value 126a is more accurately representative of the true angle of the magnetic field generated by the magnet 144 and can be an accurate representation of the true angle of the magnetic field where the second angle error component is zero or nearly zero.
The angle correction module 138 can also be coupled to receive a temperature signal 136a generated by a temperature sensor 136. The angle correction module 138 can also be coupled to receive sine values, here shown as two sine values 148a, 148b, from a sine look up table (LUT) 148. In some embodiments, the sine value 148a is representative of a sine value at a fundamental frequency the same as or related to a frequency of the signal 52 of FIG. 2, i.e., a frequency of the signal 104a and the signal 105a. In some embodiments, the sine value 148b is representative of a sine value at a second harmonic of the fundamental frequency. However, the sine look up table 148 can provide any number of sine values representative of any number of harmonics of the fundamental frequency. The sine lookup table 148 can be coupled to receive, and can be indexed in accordance with, the uncorrected x-y angle value 118a. 
The magnetic field sensor 100 can be coupled to receive a control signal 142 from outside of the magnetic field sensor 100. In particular, an electrically erasable programmable read-only memory (EEPROM) can be coupled to receive the control signal 142 having one or more correction coefficients, and can be configured to supply the one or more correction coefficients to the angle correction module 138 as correction coefficients 140a. 
The angle correction module 138 is described in greater detail in conjunction with FIG. 6. However, let it suffice to say here that the angle correction module 138 is responsive to the temperature signal 136a, the magnetic field strength signal 110a, the uncorrected angle value 118a, and correction coefficients 140a to generate the angle error value 138a. 
The magnetic field sensor 100 can also include a rotation speed module 130 and/or a rotation direction module 132, each coupled to receive the corrected x-y angle value 126a. It will be understood that the corrected x-y angle value 126a can change, and therefore, can be representative of a rotating magnetic field when the magnet 144 rotates.
The rotation speed module 130 is configured to generate a rotation speed signal or value 130a indicative of a rotation speed of the magnet. The rotation direction module 132 is configured to generate a direction signal or value 132a indicative of a rotation direction of the magnet 144.
An output protocol module 134 is coupled to receive the corrected x-y angle value 126a, the rotation speed value 130a, and the rotation direction value 132a. The output protocol module 134 is configured to generate an output signal 134a representative of the angle of the magnetic field generated by the magnet 144, representative of the speed of rotation of the magnet 144, and representative of the direction of rotation of the magnet 144. The output signal 134a can be provided in one of a variety of conventional formats, for example, an SPI format, a CAN format, an I2C format, or a Manchester format.
FIGS. 4-4C are representative of a four phase current spinning or chopping that can be used for a vertical Hall element having five contacts. Thus, it should be appreciated that such current spinning can be used for each selected vertical Hall element within the CVH sensing element 12 of FIG. 1 and the CVH sensing element 102 of FIG. 3. It should also be appreciated that such current spinning can also be used for separate magnetic field sensing elements, for example, the magnetic field sensing elements 30a-30h of FIG. 1A, where the magnetic field sensing elements 30a-30h are selected and chopped one of the time.
Referring now to FIG. 4, a vertical Hall element 200 of the CVH sensing element 102 of FIG. 3 is comprised of five vertical Hall element contacts, namely, first, second, third, fourth, and fifth vertical Hall element contacts, 202a, 202b, 202c, 202d, 202e, respectively. In a first chopping or current spinning phase, a current source 208, which can be the same as or similar to the current sources 103 of FIG. 3, can be coupled to the first and fifth vertical Hall element contacts 202a, 202e, respectively, which are coupled together, and can provide a total current of I, half of the current, I/2, flowing to the first vertical a Hall element contact 202a and half of the current, I/2, flowing to the fifth vertical Hall element contact 202e. The third vertical Hall element contact 202c is coupled to a voltage reference 210, for example, ground. Currents from the current source 208 flow from the first and fifth vertical Hall element contacts 202a, 202e, respectively, through a substrate 206 (e.g., through an epitaxial layer upon a substrate) of the CVH sensing element 200 to the third vertical Hall element contact 202c, as represented by dashed lines.
A signal, Vm, responsive to an external magnetic field, results between the second and fourth vertical Hall element contacts 202b, 202d, respectively. Thus, in the first current spinning phase, the current spinning switches 105 of FIG. 3 can select the second and fourth vertical Hall element contacts 202b, 202d to provide the output signal 105a, and can select the first, fifth, and third vertical Hall element contacts 202a, 202e, 202c, respectively, as those contacts coupled to the current sources 103 of FIG. 3. Couplings during other current spinning phases described below will be apparent.
Referring now to FIG. 4A, in which like elements of FIG. 4 are shown having like reference designations, in a second current spinning phase of the same vertical Hall element 200 (same five vertical Hall element contacts) of the CVH sensing element 102, couplings are changed by the current spinning switches 105 of FIG. 3. In the second phase, the current source 208 is coupled to the third vertical Hall element contact 202c, and the first and fifth vertical Hal element contacts 202a, 202e, respectively, are coupled together and to the reference voltage 210. Thus, the currents flow through the substrate 206 in opposite directions from those shown in FIG. 4.
As in FIG. 4, a signal, Vm, responsive to an external magnetic field, results between the second and fourth vertical Hall element contacts, 202b, 202d, respectively. The signal, Vm, of FIG. 4A is like the signal, Vm, of FIG. 4. However, the offset voltage within the signals can be different, e.g., different in sign.
Referring now to FIG. 4B, in which like elements of FIGS. 4 and 4A are shown having like reference designations, in a third current spinning phase upon the same vertical Hall element 200 (same five vertical Hall element contacts) of the CVH sensing element 102), couplings are again changed by the current spinning switches 105. In the third phase, the current source 208 is coupled to the second vertical Hall element contact 202b, and the fourth vertical Hall element contact 202d is coupled to the reference voltage 210. Thus, a current flows from the second vertical Hall element contact 202b through the substrate 206 to the fourth vertical Hall element contact 202d. 
The first and fifth vertical Hall element contacts 202a, 202e, respectively, are coupled together. Some current also flows from the second vertical Hall element contact 202b through the substrate 206 to the first vertical Hall element contact 202a and through the mutual coupling to the fifth vertical Hall element contact 202e. Some current also flows from the fifth vertical Hall element contact 202e through the substrate 206 to the fourth vertical Hall element contact 202d. 
A signal, Vm, responsive to an external magnetic field, results between the first vertical Hall element contact 202a first (and the fifth vertical Hall element contact 202e) and the third vertical Hall element contact 202c. The signal, Vm, of FIG. 4B is like the signal, Vm, of FIGS. 4 and 4A. However, the offset voltage within the signal can be different.
Referring now to FIG. 4C, in which like elements of FIGS. 4-4B are shown having like reference designations, in a fourth chopping phase upon the same vertical Hall element 200 (same five vertical Hall element contacts) of the CVH sensing element 102, couplings are again changed by the current spinning switches 105. In the fourth phase, the current is reversed from that shown in FIG. 4B. The current source 208 is coupled to the fourth vertical Hall element contact 202d, and the second vertical Hall element contact 202b is coupled to the reference voltage 210. Thus, a current flows from the fourth vertical Hall element contact 202d through the substrate 206 to the second vertical Hall element contact 202b. 
The first and fifth vertical Hall element contacts 202a, 202e, respectively, are coupled together. Some current also flows from the fourth vertical Hall element contact 202d through the substrate 206 to the fifth vertical Hall element contact 202e, through the mutual coupling to the first vertical Hall element contact 202a. Some current also flows from the first vertical Hall element contact 202a through the substrate 206 to the second vertical Hall element contact 202b. 
A signal, Vm, responsive to an external magnetic field, results between the first vertical Hall element contact 202a (and the fifth vertical Hall element contact 202e) and the third vertical Hall element contact 202c. The signal, Vm, of FIG. 4C is like the signal, Vm, of FIGS. 4-4B. However, the offset voltage within the signal can be different.
The signals, Vm, provided by the four phases of chopping of FIGS. 4-4C are responsive to an external magnetic field.
As described above, after generating the four current spinning phases on any one vertical Hall element within the CVH sensing element 102, by sequencing operation of the sequence switches 104 of FIG. 3, the current spinning arrangements of FIGS. 4-4C can move to a next vertical Hall element, e.g., five vertical Hall element contacts offset by one vertical Hall element contact from those shown in FIGS. 4-4C, and the four current spinning phases can be performed on the new vertical Hall element by operation of the current spinning switches 105 of FIG. 3.
However, in some embodiments, a sequence of phases (A, B, C, D) represented by the four current spinning phases of FIGS. 4-4C, can be changed in one of a variety of ways. For example, in some embodiments, the sequence of the (A, B, C, D) phases can be randomly selected for each one of the selected vertical Hall elements within the CVH sensing element 102. In some embodiments the random selection is fully random, and in some other embodiments, the random selection is a pseudo-random selection. In some embodiments, the random or pseudo random selection is within each rotation around the CVH sensing element, and in other embodiments, the random or pseudo random selection is among a plurality of rotations around the CVH sensing element.
In some other embodiments, the vertical Hall elements within the CVH sensing element 102 can be partitioned into at least two groups or sets of vertical Hall elements, wherein a first set of the vertical Hall elements uses a first sequence of current spinning phases, e.g., ABCD, and a second set of the vertical Hall elements uses a second different sequence of current spinning phases, e.g., CDAB each time the sequence switches 104 sequence around the CVH sensing element 102. There can be one or more vertical Hall elements within each one of the at least two sets of vertical Hall elements. Other variations of phase sequences are also possible, for example, using different phase sequences for any possible number of sets of vertical Hall elements, for example, three, four, five, or more, including twenty-four respective sets of vertical Hall elements, each time the sequence switches 104 sequence around the CVH sensing element 102.
In some embodiments, the above-described different sets of vertical Hall elements receive the above-described randomly or pseudo randomly selected phase sequences selected within each rotation around the CVH sensing element, and in other embodiments, the random or pseudo random selection is among a plurality of rotations around the CVH sensing element.
Thus, in general, there can be variations in, or differences in, the current spinning phase sequences among the plurality of vertical Hall elements within the CVH sensing element 102.
Reasons for selection of a different phase sequences among the vertical Hall elements of the CVH sensing element 102 are described more fully below in conjunction with FIG. 5.
Referring now to FIG. 5, a graph 300 has a horizontal axis with a scale in units of angular degrees and a vertical axis with a scale in units of value of an x-y angle value magnitude, for example, a magnitude of the uncorrected x-y angle value 118a of FIG. 3.
A line 302 is representative of an x-y angle value that has no angle error. When the x-y angle value has no angle error, the x-y angle value is perfectly linear with respect to actual angle, i.e., the x-y angle value is a perfect and true representation of the angle of the magnetic field generated by the magnet 144 of FIG. 3, and the line 302 passes through zero.
A line 304 is representative of an x-y angle value that has only an average or DC angle error, such that all angles represented by the x-y angle value are offset by a fixed number of degrees. The line 304 does not pass through zero.
A curve 306 is representative of an x-y angle value that has errors in representation of the true angle of the magnetic field generated by the magnet 144, average or DC errors and also an error that has a sinusoidal appearance.
A curve 308 is representative of an x-y angle value that has other errors in representation of the true angle of the magnetic field generated by the magnet 144.
A variety of circuit characteristics of the magnetic field sensor 100 contribute to the errors, i.e., to both the DC (or average) angle error represented by the curves 306, 308, and to the sinusoidal shapes of the curves 306, 308. One factor that contributes to the errors is switching noise generated by the sequence switches 104 and/or by the current spinning switches 105 of FIG. 3.
First, regarding the sequence switches 104, it will be understood that charge injection or switching spikes (together referred to as noise) generated by the sequence switches 104 are not necessarily exactly the same as each sequential vertical Hall element is selected in the CVH sensing element 102. When the noise generated by the sequence switches 104 is not the same as each vertical Hall element is selected, a DC (or average) angle error is generated and also a sinusoidal type error such as that represented by the curves 306, 308. The sinusoidal error characteristic can be, in part, a result of the noise generated by the sequence switches being repetitive for each cycle around the CVH sensing element 102, and thus, the noise will have an angle error frequency component at a frequency of the signal 52 of FIG. 2, and will add to the signal 52 (104a of FIG. 3). The angle error frequency component is essentially fixed in phase relative the signal 104a, and therefore, the addition of the angle error causes different phase shift errors in the summed signal depending on the phase of the signal 104a. Higher harmonics can also result from the noise.
Next, regarding the current spinning switches 105, it will be understood that charge injection or switching spikes (together referred to as noise) generated by the current spinning switches 105 are not necessarily exactly the same as each sequential vertical Hall element is selected in the CVH sensing element 102. When the noise generated by the current spinning switches 105 is not the same as each vertical Hall element is selected, a DC (or average) angle error is generated and also a sinusoidal type error such as that represented by the curves 306, 308. The sinusoidal error characteristic can, in part, result from the noise generated by the current spinning switches 105 being repetitive for each cycle around the CVH sensing element. However, by techniques described herein, phase sequences of the vertical Hall elements within the CVH sensing element 102 can be varied, and thus, the noise generated by the current spinning switches 105 need not be repetitive for each cycle around the CVH sensing element, and corresponding angle error is reduced.
Other circuit characteristics can also contribute to the angle errors, i.e., to both the DC (or average) angle error represented by the error curves 306, 308, and to the sinusoidal shapes of the error curves 306, 308. Namely, a speed with which the dual differential amplifier 108 of FIG. 3, and also other circuit elements of FIG. 3, settle to final values as the sequence switches 104 switch among the vertical Hall elements of the CVH sensing element 102, and also as the current spinning switches 105 switch among the various current spinning phases, contribute to the errors.
The above-described circuit characteristics, including, but not limited to, switching noise and lack of circuit elements settling to final values, tend to be influenced by (i.e., changed by) a variety factors including, but not limited to, temperature of the magnetic field sensor 100 of FIG. 3, rate of sequencing around the CVH sensing element 102, peak magnitude of the magnetic field experienced by the CVH sensing element 102 as the magnet 144 rotates, and selected current spinning sequence(s) among the various vertical Hall elements.
Differences between the curves 306, 308 can be attributed to changes in the same factors, namely, changes in the temperature, changes in or differences in peak amplitude of the magnetic field experienced by the CVH sensing element 102 as the magnet 144 rotates, changes in or differences in rates of sequencing around the CVH sensing element 102, and changes in or differences in selected current spinning sequence(s) among the various vertical Hall elements within the CVH sensing element 102. Among these factors, it will be understood that the changes in the temperature can occur at any time. The changes in the peak amplitude of the magnetic field can be influenced by positional changes, i.e., air gap changes, between the magnet 144 and the CVH sensing element 102 of FIG. 3. Furthermore, the impact of magnetic field strength variations on the angle error can vary with the application configuration. For example, so called “end of shaft” configurations (in which the magnetic field sensor is positioned along the axis of rotation of the rotating target) can experience less impact than so called “side shaft” configurations in which the magnetic field sensor is positioned to the side of the axis of rotation).
The changes in the peak amplitude of the magnetic field can also be influenced by mechanical considerations, for example, wear of a bearing or a shaft upon which the magnet 144 rotates. However, the changes in sequencing rates and the changes in current spinning sequences can be fixed, and changed only for different applications of the magnetic field sensor 100.
In general, it has been determined that the dominant angle error frequency components occur at first and second harmonics of the frequency of the signal 52 (i.e., 104a or 105a). The curves 306, 308 are representative of angle error functions dominated by first and second harmonics of the frequency of the signal 52 (104a).
The angle error correction module 138 of FIG. 3 is configured to make changes to angle error corrections it applies according to at least the temperature and magnetic field contributions to the angle error represented by the curves 306, 308. In some embodiments, the angle error correction module 138 is also configured to make changes to the angle error corrections according to one or more of the other above-described factors that contribute to the difference between the curves 306, 308.
As described herein, angle errors represented by the curves 306, 308 and contained in the uncorrected angle value 118a (FIG. 3) are referred to as first angle errors, each influenced by the above factors. Other angle error curves (not shown) with lower peak to peak variation than the error curves 306, 308 are representative of second angle errors that are smaller than the first angle errors and that are contained in the corrected angle value 126a (FIG. 3).
Mathematically, the angle error represented by the curves 306, 308 can be represented as:




  
    
      
        
          
            e
            ^
          
          ⁡
          
            (
            
              θ
              ,
              T
              ,
              B
            
            )
          
        
        =
        
          
            dc
            T
          
          +
          
            
              (
              
                
                  B
                  0
                
                B
              
              )
            
            ⁢
            h
            ⁢
            
              
            
            ⁢
            1
            ⁢
            
              
            
            ⁢
            
              a
              T
            
            ⁢
            
              sin
              ⁡
              
                (
                
                  θ
                  +
                  
                    h
                    ⁢
                    
                      
                    
                    ⁢
                    1
                    ⁢
                    
                      
                    
                    ⁢
                    
                      p
                      T
                    
                  
                
                )
              
            
          
          +
          
            
              (
              
                
                  B
                  0
                
                B
              
              )
            
            ⁢
            h
            ⁢
            
              
            
            ⁢
            2
            ⁢
            
              
            
            ⁢
            
              a
              T
            
            ⁢
            
              sin
              ⁡
              
                (
                
                  
                    2
                    ⁢
                    θ
                  
                  +
                  
                    h
                    ⁢
                    
                      
                    
                    ⁢
                    2
                    ⁢
                    
                      
                    
                    ⁢
                    
                      p
                      T
                    
                  
                
                )
              
            
          
        
      
    
    
      
        (
        1
        )
      
    
  




where:

    
    
        ê=angle error value (signal 138a of FIG. 3);
        T=temperature measured by temperature sensor 136;
        dcT=a DC angle error, which is a function of the temperature, T;
        h1aT=an amplitude of a first harmonic component of the error, which is a function of the temperature, T;
    
    


h1pT=a phase of the first harmonic component, which is a function of the temperature, T;

    
    
        h2aT=an amplitude of a second harmonic component of the error, which is a function of the temperature, T;
        h2pT=a phase of the second harmonic component, which is a function of the temperature, T;
        B0=the nominal field strength, which is a function of the temperature, T;
        B=the measured magnetic field strength; and
        θ=the uncorrected magnetic field angle value (signal 118a of FIG. 3).

The nominal field strength (B0) as a function of temperature (T) can be represented as follows:

    
    






  
    
      
        
          B
          0
        
        =
        
          
            
              (
              
                
                  
                    B
                    hot
                  
                  -
                  
                    B
                    room
                  
                
                
                  
                    T
                    hot
                  
                  -
                  
                    T
                    room
                  
                
              
              )
            
            ⁢
            
              (
              
                T
                -
                
                  T
                  room
                
              
              )
            
          
          +
          
            B
            room
          
        
      
    
    
      
        (
        2
        )
      
    
  




where

    Troom room temperature (nominally 25° C.);
    Thot=a hot temperature (such as 125° C. or 150° C.);
    Broom magnetic field strength measured at room temperature; and
    Bhot=magnetic field strength measured at the hot temperature.


While the error representation of equation (1) utilizes B0/B as the correction for the first harmonic amplitude and for the second harmonic error component, it will be appreciated that other correction factors such as the square root of B0/B may be used to model the angle error. Furthermore, other factors described above, other than temperature (T) and the peak amplitude of the magnetic field (B) experienced by the CVH sensing element 102 and generated by the magnet 144, which affect the angle error, are not taken into account in equation (1). Namely, the rate of sequencing around the CVH sensing element 102 is not taken into account and the current spinning phase sequence generated by the current spinning sequence selection module 119 is not taken into account in the above expression.
It is described below in conjunction with FIGS. 6-6C that the angle error correction module 138 of FIG. 3 can use programmable correction coefficients 140a stored in the EEPROM 140 to evaluate an expression the same as or similar to equation (1) in order to thereby generate the angle error value 138a. Thus, the EEPROM 140 can be configured to store a plurality of correction coefficients or values associated with the above equation (1). In some embodiments, the stored correction coefficients values can be programmed into the coefficient table EEPROM 140, for example, by way of the control signal 142 (FIG. 3).
As described above in conjunction with FIG. 3, the combining module 126 is operable to combine the angle error value 138a (i.e., the estimated error according to equation (1)), which is temperature and magnetic field strength dependent, with the uncorrected x-y angle value 118a to generate the corrected x-y angle value 126a that is more accurate and has a smaller (i.e., a second) error smaller than the first error of the uncorrected x-y angle value 118a. Thus, for each uncorrected angle value 118a, the estimated error, ê, computed according to equation (1) can be digitally subtracted from (or added to) or otherwise mathematically combined with the sensed (i.e., measured) angle (i.e., the uncorrected x-y angle value 118a of FIG. 3).
Variation in current spinning phase sequences is described above in conjunction with FIG. 3. An angle error correction module 138 is also described above in conjunction with FIGS. 3 and 5. It should be apparent that both a proper selection of the variation of the current spinning phase sequences and the use of the angle error correction module 138 tend to reduce a magnitude of the angle error represented by the curves 306, 308. It should be appreciated that the two techniques can be used separately or together to achieve a reduction in angle error of the magnetic field sensor 100.
Referring now to FIG. 6, a process 320 for generating a corrected magnetic field angle value 126a includes generating and storing correction coefficients 324. Generating and storing correction coefficients is generally performed during manufacture of the magnetic field sensor 100 and may include measuring the magnetic field angle at two or more temperatures, such as at room temperature (T0) and at a “hot” temperature (Thot) such as 125° C. or 150° C. In making such measurements, a known magnetic field angle and field strength are used.
Each of these angle measurements results in a measured angle value (θ) that includes error components that can be expressed in the form of equation (1) and thus, includes a DC component, a first harmonic amplitude component, a first harmonic phase component, a second harmonic amplitude component, and a second harmonic phase component. In one embodiment, the correction coefficient values that are stored in the EEPROM 140 are the values of these individual error components at room temperature (i.e., dc0, h1a0, h1p0, h2a0, h2p0) along with respective corresponding scale factors (i.e., dc, h1a, h1p, h2a, h2p) based on temperature, as will be explained. Suffice it to say here that these correction coefficients are used by the correction module 138 to evaluate the error terms (dcT, h1aT, h1pT, h2aT, h2pT) of equation (1). For simplicity, although the scale factor correction coefficients (i.e., dc, h1a, h1p, h2a, h2p) are generated and stored during manufacture (in block 324 of FIG. 6), these correction coefficients will be explained further below in connection with FIG. 6C. It will be appreciated that in other embodiments, the values stored in the EEPROM may be the individual error components at both room temperature and at the hot temperature.
Additional correction coefficients stored in EEPROM 140 can include a value (T0) measured at the output of the temperature sensor 136 at room temperature, a temperature scale factor (TS) used to compute the difference between the actual temperature (T) and room temperature, a magnetic field measurement at room temperature (MFO0), a magnetic field offset scale factor (MFO) representing an offset between the magnetic field measurement at room temperature and at the hot temperature, a magnetic field measurement at a nominal field strength, such as 300 G (MFS0), and a magnetic field strength scale factor (MFS) representing a scale factor between the magnetic field measurement at the nominal field strength and a magnetic field measurement at a second field strength, such as 150 G. The temperature scale factor (TS) is computed by recording the sensor reading at room temperature and at a hot temperature, creating a scale factor to correct the measured temperature change to the known temperature change. Although the magnetic field offset scale factor correction coefficient (MFO) and magnetic field strength scale factor correction coefficient (MFS) are generated and stored during manufacture (in block 324 of FIG. 6), these correction coefficients will be explained further below in connection with FIG. 6C.
In operation, the magnetic field sensor 100 generates an uncorrected angle value 118a (block 326) which triggers measurement of the magnetic field (block 328) and temperature (block 332). At block 326, the magnetic field strength is measured and provided to the angle error correction module 138 in the form of signal 110a as will be explained further in connection with FIG. 6A. The ambient temperature is measured by temperature sensor 136 and provided to the angle error correction module 138 in the form of signal 136a in block 332 as will be explained further in connection with FIG. 6B. In one embodiment, the temperature may be measured and updated on the order of every 4 milliseconds.
In block 336, the magnetic field angle θ is calculated by the angle calculation module 118 (FIG. 3) and the uncorrected angle value in the form of signal 118a is provided to the sine lookup table 148. The sine lookup table 148 can provide first and second harmonic sine values 148a, 148b, respectively, to the angle error correction module 138 for use in evaluating equation (1) above. The magnetic field angle θ is derived from successive samples of the magnetic field strength measured in block 326. As one example, the magnetic field angle can be derived by analyzing every 16 samples for a zero amplitude crossing. The magnetic field strength may be derived in block 328 over a longer period of time, e.g. 64 samples. It will be appreciated that the particular order of the blocks and frequency of processing the blocks illustrated in the flow diagrams of FIGS. 6-6C can be varied.
In block 340, the angle error correction module 138 evaluates equation (1) as will be explained further in connection with FIG. 6C, following which the angle measurement and correction process can be repeated as illustrated by arrow 348.
Referring also to FIGS. 6A, 6B, and 6C, illustrative processes for performing blocks 328, 332, and 340, respectively, are shown. In FIG. 6A, the magnetic field strength is updated by accumulating samples of the band pass filtered signal (BPFSAMP) 110a (FIG. 3) at block 350, following which the accumulated samples are filtered, such as by a lowpass filter, at block 354. More particularly, the absolute value of the input signal 110a is accumulated until N samples have been processed. In a typical application, there are 16 samples per period and the accumulation is performed over 8 periods, or N=16*8=128. This accumulation of the absolute value of samples is equivalent to a full-wave rectifier followed by a sinc lowpass decimation, as represented by block 354.
The process illustrated by blocks 358-378 can be used to generate a field strength ratio term (FRATIO) that is then used to compute the angle error value in FIG. 6C. It will be appreciated that in the context of equation (2) above, the term B0/B is equivalent to FRATIO, albeit such terms computed in a different manner. In particular, the equation (2) term B0/B uses a value B0 that represents the nominal field strength adjusted for temperature; whereas the FRATIO term represents an adjustment to the measured field strength to account for variations due to temperature and field strength changes.
In block 358, an offset, MFOT, between the accumulated and filtered magnetic field strength and nominal magnetic field strength (such as 300 Gauss) as a function of temperature and in response to data 360, including TDELTA, MFO0, and MFO, is computed as follows:

MFOT=FSLP−(MFO0+(TDELTA)(MFO))  (3)

where

FSLP=the filtered field strength from block 354;
MFO0=nominal magnetic field strength measured at room temperature and stored in EEPROM 140;
MFO=magnetic field offset scale factor representing the offset between the nominal magnetic field measurement at room temperature and at the hot temperature stored in EEPROM; and
TDELTA=a scaled difference between the measured temperature (T) and the room temperature measurement (T0) as explained further below in connection with FIG. 6B.
In block 362, a scale factor for the offset to field strength as a function of temperature, MFST, is computed in response to data 362 including TDELTA, MFS0, and MFS as follows:

MFST=MFS0+(TDELTA)(MFS)  (4)

Where

MFS0=the measured scale factor for change in magnetic field strength at room temperature, calculated as the ratio of the measured difference in two applied fields to the ideal difference. Typical field strengths are 300 G and 150 G; and
MFS=the temperature scale factor for magnetic field strength change. MFS is calculated in a similar manner as MFS0, only at two temperatures such as room and hot as follows:




  
    
      
        MFS
        =
        
          
            
              MFS
              room
            
            -
            
              MFS
              hot
            
          
          
            
              T
              room
            
            -
            
              T
              hot
            
          
        
      
    
    
      
        (
        5
        )
      
    
  




In block 366, the magnetic field strength (FS) is computed in Gauss as illustrated by equation (6), following which the magnetic field strength is stored in block 370:

FS=300+(MFOT/MFST)  (6)

A field strength ratio FRATIO is computed at block 374 as the ratio of the nominal field strength such as 300 G to the magnetic field strength FS computed by equation (6), following which the field strength ratio FRATIO is stored in step 378.
Referring also to FIG. 6B, a process 332 for measuring and storing temperature is illustrated. In step 400, a temperature delta, TDELTA, is computed in response to data 402; namely, the measured temperature value (T), the temperature value to corresponding to room temperature (T0), and the temperature scale factor TS as shown. In step 404, the temperature in Kelvin, TKELVIN, is computed as shown. If, in step 408, it is determined that the temperature delta, TDELTA, is either less than −75° C. or greater than 150° C., then in step 416, an error condition is indicated and the previous values for TKELVIN and TDELTA are retained. Otherwise, the new temperature value in Kelvin, TKELVIN, and temperature delta, TDELTA, are stored in step 416, as shown.
Referring also to FIG. 6C, a process 340 for calculating the angle error value, ê, is illustrated. In block 430, the first harmonic amplitude as a function of temperature, h1aT, is computed according to the following equation (7) in response to data 432; namely, TDELTA, h1a0, and h1a.

h1aT=h1a(TDELTA)+h1a0  (7)

where

h1a0=first harmonic amplitude measured at room temperature and stored in EEPROM 140;
h1a=first harmonic amplitude scale factor, stored in EEPROM.
The first harmonic amplitude scale factors, h1a, can be computed as illustrated by equation (8):




  
    
      
        
          h
          ⁢
          
            
          
          ⁢
          1
          ⁢
          
            
          
          ⁢
          a
        
        =
        
          
            
              h
              ⁢
              
                
              
              ⁢
              1
              ⁢
              
                
              
              ⁢
              
                a
                hot
              
            
            -
            
              h
              ⁢
              
                
              
              ⁢
              1
              ⁢
              
                
              
              ⁢
              
                a
                0
              
            
          
          
            
              T
              hot
            
            -
            
              T
              room
            
          
        
      
    
    
      
        (
        8
        )
      
    
  




where

    h1a0=the first harmonic amplitude at room temperature, as stored in EEPROM 140 in step 324; and
    h1ahot=the first harmonic amplitude at the hot temperature.


It will be appreciated that the remaining harmonic amplitude and scale factors h1p, h2a, h2p (used as described below) can be computed in the same general manner as the first harmonic amplitude scale factor h1a, but with appropriate substitution of the corresponding harmonic amplitude and phase measurements.
The first harmonic amplitude is scaled by the magnetic field scale factor, or FRATIO, as may be computed according to FIG. 6A (block 434).
In block 438, the first harmonic phase as a function of temperature, h1pT, is computed according to the following equation (9) in response to data 440; namely, TDELTA, h1p0, and h1p.

h1pT=h1p(TDELTA)+h1p0  (9)

where

h1p0=second harmonic phase measured at room temperature and stored in EEPROM 140; and
h1p=second harmonic phase scale factor, stored in EEPROM and computed as explained above.
In block 442, the first harmonic error component of equation (1) is computed as shown, in response to data 444 including the sine term 148a based on the uncorrected angle value θ, the first harmonic amplitude h1aT computed at 434, and the first harmonic phase h1pT computed at 438.
In block 446, the second harmonic amplitude as a function of temperature, h2aT, is computed according to the following equation (10) in response to data 448; namely, TDELTA, h2a0, and h2a.

h2aT=h2a(TDELTA)+h2a0  (10)

where

h2a0=second harmonic amplitude measured at room temperature and stored in EEPROM 140; and
h2a=second harmonic amplitude scale factor, stored in EEPROM and computed as explained above.
As shown at 450, the second harmonic amplitude is scaled by the magnetic field strength ratio FRATIO, as may be computed according to FIG. 6A.
At block 454, the second harmonic phase as a function of temperature, h2pT, is computed according to the following equation (11) in response to data 456; namely, TDELTA, h2p0, and h2p.

h2pT=h2p(TDELTA)+h2p0  (11)

where

h2p0=second harmonic phase measured at room temperature and stored in EEPROM 140; and
h2p=second harmonic phase scale factor, stored in EEPROM and computed as explained above.
At block 458, the second harmonic error component of equation (1) is computed as shown, in response to data 460 including the sine term 148b based on the uncorrected angle θ, the second harmonic amplitude h2aT computed at 450 and the second harmonic phase h2pT computed at 454.
At block 462, the average or DC angle error as a function of temperature, dcT, is computed according to equation (12) in response to data 464 including TDELTA, dc0, and dc as follows:

dcT=dc(TDELTA)+dc0  (12)

where

    dc0=DC error component at room temperature, as stored in EEPROM 140 in step 324; and
    dc=a scale factor, stored in EEPROM and calculated during manufacture as follows:






  
    
      
        dc
        =
        
          
            
              dc
              hot
            
            -
            
              dc
              0
            
          
          
            
              T
              hot
            
            -
            
              T
              0
            
          
        
      
    
    
      
        (
        13
        )
      
    
  




where

    dchot=DC error component at the hot temperature.


In step 466, the angle error value ê (equation (1)) is computed by adding the error components including the dc error component computed in step 462, the first harmonic error component computed in step 442, and the second harmonic error component computed in step 458 and the corrected angle value 126a is computed by subtracting the angle error value ê from the uncorrected angle value θ. In step 470 the corrected angle value 126a is stored. It will be appreciated that while block 466 is shown in FIG. 6C as being part of the process 340 for computing the angle error value ê by the angle error correction module 138, this operation may alternatively be performed by combining module 126 external to the angle error correction module as illustrated in FIG. 3.
While correction coefficients representative of a value of the DC component of the angle error, amplitude and phase values of the first harmonic of the angle error, amplitude and phase values of the second harmonic of the angle error, and related scale factors are described, in other embodiments, fewer than, more than, or different correction coefficients can be stored and used. For example, correction coefficients representative of even higher harmonics can be stored and used, for example, by appropriate expansion of equation (1).
The angle error correction module 138 can include an analog-to-digital converter coupled to receive the temperature signal 136a from the temperature sensor 136 and configured to generate a converted signal, which is a digital signal representative of the temperature of the magnetic field sensor 100. In some embodiments, the angle error correction module 138 can optionally include a temperature change detection module coupled to receive the digital temperature signal and configured to identify if the digital temperature signal is representative of a change in temperature or representative of no change temperature. The temperature change detection module can be configured to generate a control signal also indicative of a change in temperature or indicative of no change in temperature.
In some embodiments, the angle error correction module 138 can include one or more of a correction versus current spinning sequence module or a correction versus sequence rate module. For example, in response to a clock signal 120b (FIG. 3), the correction versus current spinning sequence module is configured to identify a correction factor related to the selected sequence of current spinning phase sequence groups that can be applied to further improve the x-y angle error value 138a. In response to the clock signal 120d (FIG. 3), the correction versus sequence rate module is configured to identify a correction factor related to the rate at which vertical Hall elements within the CVH sensing element 102 of FIG. 3 are sequenced, which correction factor can be applied to further improve the x-y angle error value 138a. 
In some embodiments, a user can program the magnetic field sensor 100 of FIG. 3 to use a selected type of expression within the angle error correction module 138. Thus, in some embodiments, the magnetic field sensor 100 uses equation (1), and in other embodiments, the magnetic field sensor uses a different angle error expression.
Returning again to the subject of variations or changes of current spinning phase sequences first described above in conjunction with FIG. 3 with respect to a the CVH sensing element 102, FIGS. 7-9 show the advantages of similar current spinning phase sequence variations applied to a simple planar Hall Effect element.
Referring to FIG. 7, a simple magnetic field sensor 472 includes a planar Hall Effect element 474. The Hall element 474 is coupled to receive a current signal 484a at different selected ones of four contacts in accordance with a plurality of current spinning phases determined by current spinning switches 484. A current source 482 supplies a current signal 482a to the current spinning switches 484.
A differential output 474a, 474b of the Hall effect element 474 is coupled to current spinning switches 476, which select different ones of the four terminals as the output terminals as current spinning progresses through the plurality of phases.
Specific couplings for two or four phase current spinning of the four terminal planar Hall element are not shown herein but are well understood. Taking an example where the current spinning is done in four phases and labeling the phases with letters, a conventional arrangement would repeat the same phase sequence periodically, e.g., ABCD, where each sequence of phases occurs in a respective current spinning cycle having a cycle period. However, the magnetic field sensor 472 can include a current spinning and filter control module 480 coupled to the current spinning switches 476 484, which can be configured to vary or change the sequence of phases from time to time or upon each cycle through a set of four phases. The variations can be fully random or pseudo-random. However, in other arrangements the variations can select between two or more current spinning phase sequences from time to time.
In one non-limiting example, current spinning phases can take on the following four sequences and then repeat: ABCD, BCDA, CDAB, DABC. In this particular example, only four current spinning phase sequences are used, each having four phases. However, it will be understood that four current spinning phases can result in twenty-four combinations of the four phases in twenty-four current spinning phase sequences. The twenty-four current spinning phase sequences can be randomly selected, pseudo-randomly selected, or periodically selected.
In a basic and non-limiting embodiment, there are only two current spinning phase sequences, e.g., ABCD and CDAB, and the current spinning phase sequence applied to the Hall element 474 can be changed from time to time between the two phase sequences. There can also be more than two phase sequences and the current spinning phase sequence applied the Hall element 474 can be changed from time to time between the more than two phase sequences.
The current spinning switches 404 are configured to provide a differential output signal 476a, 476b. A filter 478 is coupled to receive the differential signal from the current spinning switches 476 and is configured to provide a differential output signal 478a, 478b. 
It will be understood that, in the frequency domain, a result of a particular type of current spinning, referred to herein as an offset current spinning, the differential signal 476a, 476b appearing at the current spinning switches has two frequency components. A baseband component is responsive to a magnetic field and remains at baseband. However, an offset signal component with the differential signal 476a, 476b is shifted to a higher frequency according to a frequency at which the current spinning sequences through the phases, i.e., a chopping frequency.
In operation, the filter 478 can remove the offset signal component of the differential signal 476a, 476b, leaving only the magnetically responsive signal component in the differential output signal 478a, 478b. 
Referring now to FIG. 8, a graph 486 has a horizontal axis with a scale in units of frequency in arbitrary units and a vertical axis with a scale in amplitude in arbitrary units.
The graph 486 is representative of operation of a magnetic field sensor like the magnetic field sensor 472 of FIG. 7, but without any variation of the current spinning phase sequences applied to the Hall element 474. In other words, for example, the phase sequence ABCD repeats over and over without variation.
A spectral line 490 is representative of the magnetically responsive signal component of the differential signal 476a, 476b of FIG. 7. A spectral line 496 is representative of the offset signal component of the differential signal 476a, 476b of FIG. 7 after the current spinning operation of the current spinning switches 476, 484, but without variation of the current spinning phase sequences. A spectral line 498 is representative of a third harmonic of the offset signal component represented by the spectral line 492.
It will be understood that the spectral line 490 is representative of the magnetic field sensing element 474 being responsive to a DC magnetic field. However, the magnetic field sensing element 474 can be responsive to AC magnetic fields. Thus, a baseband bandwidth 492 is representative of a region in which the magnetic field sensing element 474 can provide signal information responsive to a magnetic field.
A transfer function 488 is representative of a transfer function of one of particular embodiment of the filter 478 of FIG. 7. In particular, the transfer function 488 is representative of a digital filter having transfer function notches. In some embodiments, it is advantageous to design the filter 478 and control the filter 478 with control signal 480c such that the notches appear at the same positions as the offset component spectral lines 496, 498. Thus, with such a filter, the differential output signal 478a, 478bwill have content only within the baseband 492.
It will be recognized that use of a filter tends to slow down operation of the magnetic field sensor 472. Also, because the passband 492 must roll off below the frequency fc, the operational bandwidth or the magnetic field sensor 472 tends to be restricted.
Referring now to FIG. 9, a graph 500 has a horizontal axis with a scale in units of frequency in arbitrary units and a vertical axis with a scale in amplitude in arbitrary units.
The graph 500 is representative of operation of a magnetic field sensor like the magnetic field sensor 472, including variations or changes of the current spinning phase sequences. It will become apparent from discussion below that, using variation of the current spinning phase sequences, in some embodiments, the filter 476 of FIG. 7 can be eliminated.
A spectral line 502 is representative of the magnetically responsive signal component of the differential signal 476a, 476b. A spectral line 506 is representative of the offset signal component of the differential signal 476a, 476b after the varied current spinning operation of the current spinning switches 476, 484. A spectral line 508 is representative of a third harmonic of the offset signal component represented by the spectral line 506.
It will be understood that the spectral line 502 is representative of the magnetic field sensing element 474 being responsive to a DC magnetic field. However, the magnetic field sensing element 474 can be responsive to an AC magnetic field. Thus, a baseband bandwidth 504 is representative of a region in which the magnetic field sensing element 474 can provide signal information responsive to a magnetic field.
Other low amplitude spectral lines as shown may result from the variation of the current spinning phase sequences, depending upon the exact nature of the variation. There can be additional spectral lines that are not shown, but which are also at low amplitude.
It will be appreciated that the spectral lines 506, 508, and all other extraneous spectral lines have a much lower amplitude than the spectral lines 496, 498 of FIG. 8. In some applications, the various low amplitude spectral lines have a low enough amplitude that the filter 478 of FIG. 7 is not required in all. Having no filter at all results in a faster magnetic field sensing element and a wider bandwith magnetic field sensing element. Accordingly, in some such embodiments, the baseband passband 504 can be substantially wider than that shown, and can be wider than the baseband passband 492 of FIG. 8. In some embodiments, the baseband passband 504 can extend well beyond the frequency 3fc. 
All references cited herein are hereby incorporated herein by reference in their entirety.
Having described preferred embodiments, which serve to illustrate various concepts, structures and techniques, which are the subject of this patent, it will now become apparent to those of ordinary skill in the art that other embodiments incorporating these concepts, structures and techniques may be used. Accordingly, it is submitted that that scope of the patent should not be limited to the described embodiments but rather should be limited only by the spirit and scope of the following claims.

## Claims

1. A magnetic field sensor, comprising:
a plurality of magnetic field sensing elements, wherein each one of the plurality of magnetic field sensing elements is configured to generate a respective x-y output signal responsive to a magnetic field in an x-y plane;
an angle processing circuit coupled to receive the x-y output signals and configured to generate an uncorrected x-y angle value representative of an angle of the magnetic field in an x-y plane, wherein the uncorrected x-y angle value comprises a first angle error;
a temperature sensor configured to generate a temperature signal representative of a temperature;
an angle error correction module coupled to the angle processing circuit and the temperature sensor and configured to generate, in response to a measured magnetic field signal and the temperature signal, an x-y angle error value indicative of an error in the uncorrected x-y angle value and comprising a ratio of a nominal magnetic field strength to a measured magnetic field strength;
a coefficient table configured to store a plurality of correction coefficients for use by the angle error correction module, wherein the plurality of correction coefficients comprises a plurality of magnitudes and phases of one or more harmonics of the first angle error; and
a combining module configured to combine the uncorrected x-y angle value with the x-y angle error value to generate a corrected x-y angle value having a second angle error smaller than the first angle error.

2. The magnetic field sensor of claim 1, wherein the plurality of magnetic field sensing elements comprises a plurality of vertical Hall Effect elements arranged as a circular vertical Hall (CVH) element, wherein the plurality of vertical Hall Effect elements is configured to generate a respective plurality of x-y output signals having a direction component in an x-y plane.

3. The magnetic field sensor of claim 2, further comprising a bandpass filter responsive to the plurality of x-y output signals to generate the measured magnetic field signal.

4. The magnetic field sensor of claim 1, further comprising a sine lookup table for storing a plurality of sine values, wherein the angle error correction module is coupled to receive a sine value selected from among the plurality of sine values and to generate the x-y angle error value additionally in response to the selected sine value.

5. The magnetic field sensor of claim 4, wherein the selected sine value is selected in accordance with the uncorrected x-y angle value.

6. The magnetic field sensor of Claim 1, wherein the plurality of correction coefficients comprises respective magnitudes and phases of first and second harmonics of the first angle error.

7. The magnetic field sensor of claim 6, wherein the plurality of correction coefficients further comprises an average component of the first angle error.

8. The magnetic field sensor of claim 1, wherein the angle error correction module generates the x-y angle error value having at least two harmonics and wherein each of the at least two harmonics of the x-y angle error value is scaled by the ratio of the nominal magnetic field strength to the measured magnetic field strength.

9. The magnetic field sensor of claim 1, wherein the measured magnetic field strength is adjusted based on variations due to temperature and magnetic field strength changes.

10. The magnetic field sensor of claim 9, wherein the measured magnetic field strength is adjusted based on an offset from a calibrated reference field as a function of temperature and a scale factor as a function of temperature.

11. A method of reducing an error in a magnetic field sensor, comprising:
providing a plurality of magnetic field sensing elements, wherein each one of the plurality of magnetic field sensing elements is configured to generate a respective x-y output signal responsive to a magnetic field in an x-y plane;
using the x-y output signals to generate an uncorrected x-y angle value representative of an angle of the magnetic field in an x-y plane, wherein the uncorrected x-y angle value comprises a first angle error;
measuring a temperature to generate a temperature signal; and
correcting the uncorrected x-y angle value as a function of a measured magnetic field signal and the temperature signal to provide a corrected x-y angle value having a second angle error smaller than the first angle error, wherein correcting comprises:
storing a plurality of correction coefficients comprising storing respective magnitudes and phases of one or more harmonics of the first angle error;
storing a plurality of sine values;
using an error correction module to generate an x-y angle error value in response to the correction coefficients, wherein using the error correction module comprises selecting a sine value from among the plurality of sine values in accordance with the uncorrected x-y angle value, wherein the x-y angle error value comprise a ratio of a nominal magnetic field strength to a measure magnetic field strength; and
combining the uncorrected x-y angle value with the x-y angle error value to generate the corrected x-y angle value.

12. The method of claim 11, wherein the plurality of magnetic field sensing elements comprises a plurality of vertical Hall Effect elements arranged as a circular vertical Hall (CVH) element, wherein the plurality of vertical Hall Effect elements is configured to generate a respective plurality of x-y output signals responsive to a magnetic field having a direction component in an x-y plane.

13. The method of claim 12, further comprising filtering the plurality of x-y output signals to provide the measured magnetic field signal.

14. The method of claim 11, wherein storing the plurality of correction coefficients comprises storing respective magnitudes and phases of first and second harmonics of the first angle error.

15. The method of claim 11, wherein storing the plurality of correction coefficients further comprises storing an average component of the first angle error.

16. The method of claim 11, wherein the error correction module generates the x-y angle error value having at least two harmonics and wherein each of the at least two harmonics of the x-y angle error value is scaled by the ratio of the nominal magnetic field strength to the measured magnetic field strength.

17. The method of claim 11, wherein the measured magnetic field strength is adjusted based on variations due to temperature and magnetic field strength changes.

18. The method of claim 17, wherein the measured magnetic field strength is adjusted based on an offset from a calibrated reference field as a function of temperature and a scale factor as a function of temperature.