# Patent

## Title
Magnetic field sensor and associated method that can establish a measured threshold value and that can store the measured threshold value in a memory device

## Abstract

A magnetic field sensor includes a comparator coupled to receive a calculated threshold value based upon a temperature signal, a stored value of a temperature coefficient signal, and a stored value of a measure threshold signal, and also coupled to receive a signal representative of a magnetic field signal. The comparator is configured to compare the calculated threshold value with the signal representative of the magnetic field signal to generate an output signal. A corresponding method is associated with the magnetic field sensor.

## Background
CROSS REFERENCE TO RELATED APPLICATIONS
This application is a Continuation application of and claims the benefit of U.S. patent application Ser. No. 13/345,021, filed Jan. 6, 2012, now U.S. Pat. No. 8,736,260, issued May 27, 2014, which are incorporated herein by reference in their entirety.


STATEMENT REGARDING FEDERALLY SPONSORED RESEARCH
Not Applicable.
FIELD OF THE INVENTION
This invention relates generally to magnetic field sensors for sensing a rotation or a movement of an object and, more particularly, to a magnitude field sensor that generates a measured threshold value that can be stored in a memory device and later recalled.
BACKGROUND OF THE INVENTION
Various types of magnetic field sensing elements are known, including Hall effect elements and magnetoresistance elements. Magnetic field sensors generally include a magnetic field sensing element and other electronic components. Some magnetic field sensors also include a fixed permanent magnet.
Magnetic field sensors provide an electrical signal representative of a sensed magnetic field, or, in some embodiments, fluctuations of the magnetic field associated with the magnet. In the presence of a moving ferromagnetic object, the magnetic field sensed by the magnetic field sensor can vary in accordance with a shape or profile of the moving ferromagnetic object.
Magnetic field sensors are often used to detect movement of features of a ferromagnetic gear, such as gear teeth and/or gear slots. A magnetic field sensor in this application is commonly referred to as a “gear tooth” sensor.
In some arrangements, the gear in placed upon a target object, for example, a camshaft in an engine, thus the rotation of the target object (e.g., camshaft) is sensed by detection of the moving features of the gear. Gear tooth sensors can be used in automotive applications, for example, to provide information to an engine control processor for ignition timing control, fuel management, and other operations.
Information provided by the gear tooth sensor to the engine control processor can include, but is not limited to, an absolute angle of rotation of a target object (e.g., a camshaft) as it rotates, and a direction of rotation. With this information, the engine control processor can adjust the timing of firing of the ignition system and the timing of fuel injection by the fuel injection system. Thus, it will be recognized that accurate information about the angle of rotation is important for proper engine operation.
Gear tooth sensors can also be used in other applications, including, but not limited to, anti-lock braking systems and in transmissions.
Many types of magnetic field sensors do not provide an accurate output signal (e.g., indication of absolute angle of rotation of an object) immediately upon power up of the magnetic field sensor, and/or immediately upon movement of the target object from zero rotating speed, and/or upon movement slowing to zero rotating speed, but instead provide an accurate output signal only once the magnetic field sensor has been powered up for a period of time, and the target object has moved through a substantial rotation or is moving with substantial speed.
The above accurate output signal refers to accuracy of the positions of transition edges in the output signal from the magnetic field sensor.
In general, a so-called “running mode” detector can provide an accurate output signal only after some period following power up of the magnetic field sensor and after the gear has been rotating for some period of time. In contrast, in general, a so-called “true power on state” (TPOS) detector can provide a reasonably accurate output signal, but less accurate than the running mode detector, at an earlier time after magnetic field sensor powers up and at an earlier time after the gear starts rotating.
One type of running mode detector is described in U.S. Pat. No. 6,525,531, issued Feb. 25, 2003. This running mode detector includes a positive digital-to-analog converter (PDAC) and a negative digital-to-analog converter (NDAC) that track positive and negative peaks of magnetic field signal, respectively, for use in generating a threshold signal. A varying magnetic field signal is compared to the threshold signal. However, the outputs of the PDAC and the NDAC may not provide accurate indications of the positive and negative peaks of the magnetic field signal until several cycles of the signal (i.e., signal peaks) occur (i.e., until several gear teeth have passed).
A conventional TPOS detector is described in U.S. Pat. No. 7,362,094, issued Apr. 22, 2008. A conventional TPOS detector simply compares a magnetic field signal with a fixed and predetermined threshold.
The TPOS detector can be used in conjunction with a running mode detector, both providing information to the engine control processor. A TPOS detector can be combined in the same integrated circuit with a running mode detector, and the magnetic field sensor after power up, can first use the TPOS detector and then switch to the running mode detector.
As described above, the conventional TPOS detector provides a reasonably accurate output signal with only a small initial rotation of the target object, and before the running mode detector can provide an accurate output signal. The TPOS detector can provide information to the engine control processor that can be more accurate than information provided by the running mode detector nearly immediately upon power up of the magnetic field sensor and for time periods near the beginning and end of rotation of the target object (e.g., start and stop of the engine and camshaft), but which may be less accurate than the output signal provided by a running mode detector at some time after the magnetic field sensor has powered up and when the object is rotating at speed. When the object is rotating at speed, the engine control processor can primarily use rotation information provided by the running mode detector.
As described above, unlike the running mode detector, the conventional TPOS detector has a fixed predetermined threshold against which a magnetic field signal is compared to generate an output signal having at least two states, and typically a high and a low state. The state of the conventional TPOS output signal is high at some times and low at other times as the target object rotates, in accordance with features on the TPOS cam attached to the target object.
It is known that various parameters affect a magnitude of the magnetic field signal generated by the TPOS magnetic field sensor. For example, temperature is known to affect a sensitivity of the Hall element, and therefore, a magnitude of the magnetic field signal. Changes in size of an air gap between the TPOS magnetic field sensor and the TPOS cam or gear can also affect a magnitude of the magnetic field signal.
When the magnetic field signal is compared against a fixed predetermined threshold, the changes in the amplitude of the magnetic field signal due to temperature, air gap, etc., can cause undesirable changes in positions of the edges in the above-described output signal from the TPOS detector.
It would be desirable to provide TPOS detector for which positions of edges of an output signal therefrom vary less than for a conventional TPOS detector.
SUMMARY OF THE INVENTION
The present invention provides a TPOS detector for which positions of edges of an output signal therefrom vary less than for a conventional TPOS detector.
In accordance with one aspect of the present invention, a magnetic field sensor includes a magnetic field sensing element responsive to a changing magnetic field and configured to generate a magnetic field signal having an amplitude. The magnetic field sensor also includes an amplitude module configured to generate an amplitude signal representative of the amplitude of the magnetic field signal. The magnetic field sensor also includes a measured threshold module coupled to receive a positive peak signal and a negative peak signal representative of positive peaks and negative peaks, respectively, of the magnetic field signal, and configured to generate a measured threshold signal in accordance with the positive peak signal and the negative peak signal. The magnetic field sensor also includes a temperature sensor configured to sense a temperature of the magnetic field sensor and configured to generate a temperature signal in accordance with the temperature. The magnetic field sensor also includes a temperature coefficient module coupled to receive the temperature signal, coupled to receive the amplitude signal, and configured to generate a temperature coefficient signal in accordance with the temperature signal and the amplitude signal. The magnetic field sensor also includes a memory device coupled to receive and configured to store, at each one of a plurality of storage times, a respective value of the temperature coefficient signal and a respective value of the measured threshold signal. The magnetic field sensor also includes a threshold module coupled to receive, at a calculation time, a stored value of the temperature coefficient signal and a stored value of the measured threshold signal, each stored at a selected one of the plurality of storage times prior to the calculation time, and coupled to receive the temperature signal. The threshold module is configured to combine the received stored value of the temperature coefficient signal, the received stored value of the measured threshold signal, and the temperature signal to generate a calculated threshold value. The magnetic field sensor also includes a true power on state (TPOS) detector coupled to receive the calculated threshold value and also coupled to receive a signal representative of the magnetic field signal. The true power on state (TPOS) detector is configured to compare the calculated threshold value with a signal representative of the magnetic field signal to generate an output signal.
In some embodiments, the magnetic field sensor is powered off between the selected one of the plurality of storage times and the calculation time, and the memory device is nonvolatile and re-writable.
In another aspect of the present invention, a method of sensing a magnetic field with a magnetic field sensor includes generating a magnetic field signal having an amplitude in response to a magnetic field. The method also includes generating an amplitude signal representative of the amplitude of the magnetic field signal. The method also includes generating a measured threshold signal in accordance with positive and negative peaks of the magnetic field signal. The method also includes generating a temperature signal in accordance with a temperature. The method also includes generating a temperature coefficient signal in accordance with the temperature signal and the amplitude signal. The method also includes storing, at each one of a plurality of storage times, a respective value of the temperature coefficient signal and a respective value of the measured threshold signal. The method also includes receiving, at a calculation time, a stored value of the temperature coefficient signal and a stored value of the measured threshold signal, each stored at a selected one of the plurality of storage times prior to the calculation time. The method also includes combining the received stored value of the temperature coefficient signal, the received stored value of the measured threshold signal, and the temperature signal to generate a calculated threshold value. The method also includes comparing the calculated threshold value with a signal representative of the magnetic field signal to generate an output signal.
In some embodiments, the method includes powering off between the selected one of the plurality of storage times and the calculation time, and the storing is nonvolatile and re-writable.



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 block diagram showing a magnetic field sensor having a “true power on state” (TPOS) detector and a “running mode” detector, which is proximate to a cam having cam features, the cam disposed upon a shaft configured to rotate, i.e., upon a target object;
FIG. 2 is a block diagram showing a magnetic field signal and showing an exemplary calculated threshold and an exemplary predetermined threshold that can be compared with the magnetic field signal within the TPOS detector of FIG. 1;
FIG. 3 is a graph showing signals resulting from the comparisons of FIG. 2;
FIG. 4 is a block diagram showing further details of the magnetic field sensor of FIG. 1 and having a threshold and diagnostic module;
FIG. 5 is a block diagram showing an exemplary threshold and diagnostic module that can be used as the threshold and diagnostic module of FIG. 4; and
FIG. 6 is a block diagram showing further details of a portion of the magnetic field sensor of FIG. 4.



DETAILED DESCRIPTION OF THE INVENTION
Before describing the present invention, some introductory concepts and terminology are explained.
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 elements can be, but are not limited to, Hall effect elements, magnetoresistance elements, or magnetotransistors. As is known, there are different types of Hall effect elements, for example, a planar Hall element, a vertical Hall element, and a circular Hall element. As is also known, there are different types of magnetoresistance elements, for example, a giant magnetoresistance (GMR) element, an anisotropic magnetoresistance element (AMR), a tunneling magnetoresistance (TMR) element, an Indium antimonide (InSb) sensor, and a magnetic tunnel junction (MTJ).
A so-called “circular vertical Hall” (CVH) sensing element, another type of magnetic field sensing element, which includes a plurality of vertical magnetic field sensing elements, is known and described in PCT Patent Application No. PCT/EP2008056517, 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 includes a circular arrangement of vertical Hall elements arranged over a common circular implant region in a substrate. The CVH sensing element can be used to sense a direction (and optionally a strength) of a magnetic field in a plane of the substrate.
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 magnetoresistance elements and vertical Hall elements (including circular vertical Hall (CVH) sensing elements) tend to have axes of sensitivity parallel to a substrate.
While exemplary circuits and methods are described below that use a Hall element, in other embodiments, the same or similar techniques can be used in conjunction with another type of magnetic field sensing element.
Referring to FIG. 1, an exemplary magnetic field sensor arrangement 10 includes a magnetic field sensor 12. The magnetic field sensor 12 includes a magnetic field sensing circuit 14 having a magnetic field sensing element 16 coupled to an electronic circuit 18. The electronic circuit 18 can include a TPOS detector 18a and a running mode detector 18b, both of which are described more fully below. In other embodiments, the magnetic field sensor 12 does not have the running mode detector 18b. 
The magnetic field sensor 12 can also include a magnet 20. The magnet 20 is configured to generate a magnetic field directed along an axis 22. The electronic circuit 18 is configured to generate an output signal 24, which is generated by the TPOS detector 18a for a time period near to a start up of the magnetic field sensor 12, and which can be generated by the running mode detector thereafter.
The magnetic field sensor arrangement 10 can also include a cam 26 (e.g., gear) having features 26a, 26b, 26c, 26d. The cam 26 can be disposed, for example, upon a shaft 30 (i.e., a target object) configured to rotate in a direction 32.
In operation, as the cam 26 rotates, the cam features 26a, 26b, 26c, 26d interrupt the magnetic field generated by the magnet 20. Interruptions of the magnetic field generated by the magnet 20 are sensed by the magnetic field sensing element 16 and result in state transitions in the output signal 24.
Particular arrangement and spacing of the cam features 26a, 26b, 26c, 26d results in the TPOS detector 18a being able to provide the TPOS output signal 24 having transitions after only a small number of degrees of rotation of the TPOS cam 26, which, in some embodiments, can be interpreted by an engine control computer to generate an absolute angle of rotation of the cam 26 and of the shaft 30 upon which the cam 26 is disposed.
Furthermore, by circuits and techniques described below, the TPOS detector 18a can provide an accurate output signal at the time of power up of the magnetic field sensor 12.
Referring now to FIG. 2, a graph 50 has a horizontal axis with a scale in units of target object rotation angle, for example, from 0 to 360 degrees. The graph 50 also includes a vertical axis having a scale with units of volts in arbitrary units. A signal 52 can be the same as or similar to a magnetic field signal generated within the magnetic field sensor 12 of FIG. 1, for example, in conjunction with the magnetic field sensing element 16. It should be appreciated that the high state periods of the signal 62 correspond to the features 26a, 26b, 26c, 26d of the cam 26 of FIG. 1 as they pass by the magnetic field sensing element 16 of FIG. 1 as the cam 26 rotates.
The magnetic field signal 52 is shown in analog form having continuous analog values, but can equivalently be a signal having discrete digital values comparable to sampled ones of the analog values.
A predetermined threshold 54 is shown and further described below in conjunction with FIG. 3. The predetermined threshold 54 is similar to that which is used in a conventional TPOS detector. A calculated threshold 56, calculated (at different respective times) in accordance with one of a plurality of stored measured threshold is also shown and further described below in conjunction with FIG. 3. The calculated threshold 56, calculated in accordance with one of the plurality of stored measured threshold values, is not used by a conventional TPOS detector.
Referring now to FIG. 3, a graph 70 has a horizontal axis with a scale in units of target object rotation angle, for example, from 0 to 360 degrees. The graph 70 also includes a vertical axis having a scale with units of volts in arbitrary units.
A signal 74 has two states, positions of transitions between which are determined by crossings of the signal 52 of FIG. 2 above and below the predetermined threshold 54. A signal 72 has two states, positions of transitions between which are determined by crossings of the signal 52 of FIG. 2 above and below the calculated threshold 56. Accordingly, it can be seen that changes in the position, i.e., the value, of the threshold used to compare against the signal 52 of FIG. 2, affects positions of the transitions, i.e., edges, of the resulting two state signal. As described above, when used for many applications, including, but not limited to automotive applications, positions of the edges can be very important to proper operation of the automobile.
As described above, the magnetic field signal 52 can vary in amplitude due to a variety of environmental and electronic factors, for example, temperature and air gap between the magnetic field sensor and the sensed cam or gear. It would be desirable to maintain a threshold signal comparable to the calculated threshold 56 of FIG. 2 that is midway between positive peaks and negative peaks of the magnetic field signal 52, even as the amplitude of the positive and negative peaks changes, for example, due to temperature, air gap between the magnetic field sensing element 16 of FIG. 1 and the cam 26, or other parameters. With such an arrangement, edges of the resulting two state signal can remain at the same positions even if the amplitudes of the positive and negative peaks of the magnetic field signal 52 change and even if they change asymmetrically.
Referring now to FIG. 4, a magnetic field sensor 100 can be the same as or similar to the magnetic field sensor 12 of FIG. 1. The magnetic field sensor 100 can be disposed proximate to a cam or gear 102 having features or teeth 102a. A magnet, like the magnet 20 of FIG. 1 is not shown but can be disposed proximate to or within the magnetic field sensor 100.
A portion 104 of the magnetic field sensor 100 is shown within a box and a portion outside of the box to better explain the subject matter of FIG. 5 below.
The magnetic field sensor 100 can include a magnetic field sensing element 106, for example, a Hall element. The magnetic field sensing element 106 can provide a magnetic field signal 106a having positive and negative peaks, and which is responsive to fluctuations in a magnetic field, the fluctuations caused by passing gear teeth of the gear 102.
The magnetic field signal 106a can be received by a true power on state (TPOS) detector 110. The TPOS detector 110 can generate an output signal 110a, which can be the same as or similar to the signal 72 of FIG. 3.
An automatic gain control (AGC) 108 can also receive the magnetic field signal 106a. The AGC 108 can generate an amplified signal 108b, which is an amplitude controlled version of the magnetic field signal 106a. A running mode detector 112 can be coupled to receive the signal 108b. The running mode detector can generate an output signal 112a. The output signal 112a can be similar to the signal 72 of FIG. 3, but is generally produced having good edge accuracy later in time than the signal 110a. 
In some embodiments, the magnetic field sensor does not include the AGC 108, in which case, the magnetic field signal 106a is received by both the TPOS detector 110 and the running mode detector 112.
The output signals 110a, 112a can be received by an output switch 114. The output switch 114 can also be coupled to receive a control signal 116a generated by switch change logic 116. The control signal 116a selects between the output signals 110a and 112a and provides one of the output signals as an output signal 114a. 
The switch change logic 116 generally selects, as the output signal 114a, the output signal 110a from the TPOS detector 110 when the magnetic field sensor 104 first powers up or when the gear 102 first starts rotating or when the gear 102 is slowing to a stop. The output signal 114a remains as the output signal 110a for a period of time determined by the switch change logic 116. After the period of time, and once the gear 102 is rotating at a reasonably constant speed, the switch change logic 116 selects, as the output signal 114a, the output signal 112a from the running mode detector 112.
Operation and logic of the switch change logic 116 is not described further herein. However, exemplary operation and logic can be found within U.S. Pat. No. 7,362,094 listed above, which is incorporated by reference herein.
The magnetic field sensor 100 can also include a threshold and diagnostic module 120. This threshold and diagnostic module 120 is coupled to receive, from the AGC 108, a gain indicating signal 108c, representative of an amount of gain applied by the AGC 108. The threshold and diagnostic module 120 is also coupled to receive positive and negative peak signals 112b, 112c, respectively, from the running mode detector 112, which are indicative of magnitudes of positive peaks (P+) and negative peaks (P−) of the gain controlled magnetic field signal 108b. 
A temperature sensor 118 generates a temperature signal 118a received by the threshold and diagnostic module 120. In operation, with the various inputs provided to the threshold and diagnostic module 120, the threshold and diagnostic module 120 can generate a calculated threshold value 120a, which is like the calculated threshold 56 of FIG. 2. The calculated threshold value 120a can be maintained at any value, for example, a value representative of a halfway point, between the positive and negative peaks represented by the signals 112b, 112c. 
In some embodiments, the calculated threshold value 120a is a value that is referenced to (i.e., suitable for comparison with) the magnetic field signal 106a. However, in other embodiments, the calculated threshold value 120a is a value that is referenced to (i.e., suitable for comparison with) the amplified signal 108b. 
If the TPOS detector is coupled to receive the magnetic field signal 106a as shown, and, if the calculated threshold value 120a is scaled to suit the amplified magnetic field signal 108b, a signal 108a can be provided from the AGC 108 to the TPOS detector 100 to properly position the calculated threshold value 120a for comparison with the magnetic field signal 106a. However, other arrangements are also possible. For all arrangements, it is necessary to compare a calculated threshold value referenced to either the magnetic field signal 106a or to the amplified signal 108b with the proper respective one of the magnetic field signal 106a or the amplified signal 108b. 
Further discussion below assumes that the calculate threshold value 120a is referenced to the magnetic field signal 106a, in which case, the signal 108a may be omitted.
It will become apparent from discussion below in conjunction with FIG. 5, that the threshold and diagnostic module 120 has memory that can store a measured threshold value and a measure temperature coefficient value that can be used to generate the calculated threshold value 120a. The threshold and diagnostic module 120 can provide the calculated threshold value 120a to the TPOS detector 110 nearly immediately upon power up of the magnetic field sensor 100, and the TPOS detector 110 does not have to rely upon a predetermined fixed threshold.
The threshold and diagnostic module 120 can also generate a pass fail signal 120b, which, in some embodiments, can be stored in the threshold diagnostic module 120.
It should be apparent that with the arrangement of the magnetic field sensor 100, the TPOS detector 110 achieves more accurate edge placements in the output signal 110a, comparable to edge placements of the signal 72 of FIG. 3, nearly immediately upon power up of the magnetic field sensor 100. However, it should also be apparent that, upon a very first power up of the magnetic field sensor 100 following its installation, and before the threshold and diagnostic module 120 has successfully computed and stored a calculated threshold value, the TPOS detector 110 must still use a predetermined threshold, comparable to the predetermined threshold 54 of FIG. 2.
Referring now to FIG. 5, a threshold and diagnostic module 150 can be the same as or similar to the threshold and diagnostic module 120 of FIG. 4. The threshold and diagnostic module 150 is coupled to receive a gain signal 152a, which can be the same as or similar to the gain signal 1086 of FIG. 4. The threshold and diagnostic module 150 is also coupled to receive positive and negative peak signals 154a, 154b, which can be the same as or similar to the positive and negative peaks signals 112b, 112c, respectively, of FIG. 4.
As described above, the gain signal 152a is representative of the gain setting of the automatic gain control 108 of FIG. 4. As also described above, the positive and negative peak signals 154a, 154b, respectively, are representative of positive and negative peaks of the amplified signal 108b of FIG. 4.
An amplitude module 156 is coupled to receive the gain signal 152a and coupled to receive the positive and negative peak signals 154a, 154b, respectively, which are generated by the running mode processor 112 of FIG. 4. The amplitude module 156 is configured to generate an amplitude signal 156a representative of a peak-to-peak amplitude of the non-amplified magnetic field signal, for example, the magnetic field signal 106a of FIG. 4.
A measured threshold module 158 is coupled to receive the positive and negative peak signals 154a, 154b, respectively, and coupled to receive the gain signal 152a. The measured threshold module 158 is configured to generate a measured threshold signal 158a, which is representative of a measured threshold, for example, a value representative of a value between the positive and negative peak signals 154a, 154b, for example, a value representative of a value centered between the positive and negative peak signals 154a, 154b. 
The positive and negative peak signals 154a, 154b are representative of positive and negative peak amplitudes of the amplified signal 108b of FIG. 4. The gain signal 152a can be used by the measured threshold module 158 to reference the measured threshold signal 158a to a point before the gain of the AGC 108 of FIG. 4, and, in some embodiments, reference the measured threshold signal 158a to a peak-to-peak amplitude of the magnetic field signal 106a of FIG. 4.
In view of the above, it should be understood that the measured threshold signal 158a is representative of a measured threshold signal referenced to the magnetic field signal 106a of FIG. 4, prior to the gain of the AGC 108. Accordingly, the TPOS detector 110 of FIG. 4 can be coupled to receive the magnetic field signal 106a prior to the gain of the AGC 108.
It should also be understood that the re-referencing of the measured threshold signal 158a could instead be done at other points in the flow of signals described below.
A temperature sensor 160 can be the same as or similar to the temperature sensor 118 of FIG. 4. The temperature sensor 160 is configured to generate a temperature signal 160a, which is representative of a temperature of the environment of temperature sensor 160 and of the magnetic field sensor 100 of FIG. 4.
A temperature coefficient module 162 is coupled to receive the temperature signal 160a and coupled to receive the amplitude signal 156a. The temperature coefficient module 162 is configured to generate a temperature coefficient signal 162a, which can be representative of a temperature coefficient of the amplitude signal 156a, for example, in units of mV per degree Celsius. In order to generate the temperature coefficient, it will be understood that the magnetic field sensor must experience more than one temperature.
A threshold module 164 is coupled to receive the temperature coefficient signal 162a, coupled to receive the amplitude signal 156a, coupled to receive the temperature signal 160a, and coupled to receive the measured threshold signal 158a. 
The threshold module 164 is configured to send, from time to time, to a memory module 166 for storage, selected ones of a temperature coefficient value 164a representative of the temperature coefficient signal 162a, a measured threshold value 164b representative of the measure threshold signal 158a, a temperature value 164c representative of the temperature signal 160a, an amplitude value 164d representative of the amplitude signal 156a, or a so-called safety bit (SB) 164e described more fully below.
The threshold and diagnostic module 150 can include the memory module 166. The memory module 166 can include a primary storage area 168 and a backup storage area 170. The primary storage area 168 and the backup storage area 170 can be nonvolatile and re-writable.
The memory module 166 can also include a storage area 172 configured to store an initial (e.g., predetermined) threshold value that can be used the very first time that the magnetic field sensor, e.g., 100 of FIG. 4, is powered up after installation. The storage area 172 can be nonvolatile. The storage area 172 can be either one-time writable or re-writable.
Upon request from the threshold module 164, which acts in-part as a memory manager, the memory module 166 can provide to the threshold module 164 selected ones of a stored temperature coefficient value 166a, a stored measured threshold value 166b, a stored temperature value 166c, a stored amplitude value 166d, a stored safety bit value 166e, a stored initial threshold value 166f, a stored backup temperature coefficient value 166g, a stored backup measured threshold value 166h, a stored backup temperature value 166i, or a stored backup amplitude value 166j. 
The threshold module 164 is configured to use either some of or all of the stored values 166a-166d, or some of or all of the stored backup values 166g-166j in conjunction with the temperature signal 160a, to generate a calculated threshold value 164f, which is sent to and used by the TPOS detector 110 of FIG. 4.
The selection of which group of data to use can be determined by the stored safety bit 166e. If, for example, the stored safety bit 166e is in a first state, then the stored data 166a-166d is used, and, if the stored safety bit is in a second different state, then the stored backup data 166g-166j is used.
The safety bit 164e, 166e can be indicative of a proper storage of data. For example, when data storage begins, the safety bit 164f can be set to and stored as a particular state or value, and when the storage ends, the safety bit 164f can be set to and stored as a different particular state or value, indicating a proper storage of the data. Once retrieved, the stored safety bit 166e is indicative of the proper or improper storage of the data. If the storage of the data was proper, then the stored data 166a-166d can be used, but if the storage of data was not proper, then the backup stored data 166g-166j can used, or instead, the initial threshold value 166f can be used. The backup stored data 166g-166j can have been stored at an earlier time than the stored data 166a-166d. Improper storage can occur in circumstances described more fully below.
In some embodiments, the measured threshold value 164b stored in the memory module 166 can be representative of the measured threshold signal 158a at a particular and predetermined temperature, for example, twenty-five degrees Celsius. It will be recognized that having the stored temperature coefficient value 166a, along with the stored measured threshold value 166b at the known temperature, and along with the temperature signal 160a, the threshold module 164 can calculate the calculated threshold value 164f at any temperature experienced by the temperature sensor 160. The backup stored temperature coefficient value 166g, along with the backup stored measured threshold value 166h at the known temperature, along with the temperature signal 160a can also be used.
In other embodiments, the measured threshold value 164b stored in the memory module 166 can be representative of the measured threshold signal 158a at an arbitrary measured temperature. It will be recognized that having the stored temperature coefficient value 166a, along with the stored measured threshold value 166b at the arbitrary temperature, along with the stored temperature value 166c representative of the temperature at which the measured threshold value 164b was generated and stored as the stored measured threshold value 166b, and along with the temperature signal 160a, the threshold module 164 can calculate the calculated threshold value 164f at any temperature experienced by the temperature sensor 160. The backup stored temperature coefficient value 166g, the backup stored measured threshold value, and the backup stored temperature signal 166i, along with the temperature signal 160a can also be used.
As described above, it should be understood that, because the measured threshold signal 158a is corrected by the gain signal 152a, the stored measured threshold value 166b and the stored backup measured threshold value 166i are representative of threshold values (after adjustment to account for temperature using the temperature signal 160a and, in some embodiments, the stored temperature signal 166c) that are appropriate for comparison with the magnetic field signal 106a of FIG. 4, which is prior to the gain of the AGC 108 of FIG. 4.
It will be appreciated that the calculated threshold value 164f can be calculated in accordance with the stored measured threshold value 166b, the stored temperature coefficient value 166a, the temperature signal 160a, and, in some embodiments, the stored temperature value 166c. Thus, by using the stored values, which are retained during a power down of the magnetic field sensor 100 (FIG. 4) the calculated threshold value 166f can be generated very shortly after the magnetic field sensor 100 of FIG. 4 is powered up, each time it is powered up (other than a very first time), and the TPOS detector 110 can operate with a threshold properly centered and consistent regardless of changes in magnitude of the magnetic field signal 106a of FIG. 4, which may result from temperature and air gap changes and other changes. The resulting consistent threshold can be like the calculated threshold 56 of FIG. 2, which is properly centered in the magnetic field signal 52.
The calculated threshold value 164f can also be calculated and generated at other times while the magnetic field sensor 150 is powered up.
In operation, storage of the data 164a-164d into the primary storage area 168 of the memory module 166 can occur in a variety of ways and at a variety of times. For example, in one exemplary embodiment, storage of the data 164a-164d occurs at predetermined time intervals, for example, once per second. In another exemplary embodiment, storage of the data 164a-164d occurs based upon predetermined criteria. For example, the data 164a-164d can be stored at a time when the stored measured threshold value 166b differs from the measured threshold value 164b or from the measured threshold signal 158a by a predetermined amount or by a predetermined percentage. For another example, the data 164a-164d can be stored at a time when the stored temperature coefficient value 166a differs from the temperature coefficient value 164a or from the temperature coefficient signal 162a by a predetermined amount or by a predetermined percentage. For yet another example, the data 164a-164d can be stored at a time when the stored temperature value 166c differs from the temperature value 164c or from the temperature signal 160a by a predetermined amount or by a predetermined percentage. For yet another example, data 164a-164d can be stored at a time when the stored amplitude value 166d differs from the amplitude value 164d or from the amplitude signal 156a by a predetermined amount or by a predetermined percentage.
Calculation of and generation of the calculated threshold value 164f can occur at the same times as the above storage, or at different times, including, but not limited to, a time when the magnetic field sensor 150 first powers up. The above storing of values can occur at a plurality of storage times. The calculation and generation of the calculated threshold value 164f can occur at plurality of calculation times, which may or may not be times that include the plurality of storage times.
In operation, data stored in the primary storage a real 168 can be transferred to the backup storage area 172 in a variety of ways and at a variety of times. For example, in one exemplary embodiment, the transfer can occur at predetermined time intervals, for example, once per second. At the time of this transfer, data can be copied from the primary storage area 168 to the backup storage area 170, resulting in two same sets of data. In another exemplary embodiment, each time new data 164a-164d is stored to the primary storage area 168, data that had previously been stored in the primary storage area 168 can be moved to the backup storage area 170, resulting in two different sets of stored data.
It will be appreciated that, in some applications, for example automotive applications, the magnetic field sensor 100 of FIG. 4, which includes the threshold and diagnostic module 150 of FIG. 5, may power on and off as the automobile is turned on and off. In these applications, the power off may occur undesirably at the same time that the data 164a-164d is being stored to the primary storage area 168. In order to detect this undesirable circumstance, the safety bit 164e can be set while storage is occurring and cleared when storage is complete. If the stored safety 166e bit is in a state indicative of an interrupted storage event (e.g., power down during storage) when the threshold module 164 attempts to receive the stored data 166a-166d, then the threshold module 164 can deem the stored data 166a-166d to be invalid, in which case the threshold module 164 can instead use the stored backup data 166g-166j to compute the calculated threshold 164f. 
However, in still other embodiments, if the stored safety 166e bit is in a state indicative of an interrupted storage event when the threshold module 164 attempts to receive the stored data 166a-166d, the threshold model 164 can revert to the initial threshold value 166f as the calculated threshold value 164f. 
The threshold and diagnostic module 150 can also include a diagnostic module 174. The diagnostic module 174 can be coupled to receive selected ones of the amplitude signal 156a, the stored amplitude value 166d, the calculated threshold value 164f, the stored measured threshold value 166b, the temperature coefficient signal 162a, the stored temperature coefficient value 166a, and the stored safety bit 166e. 
In operation, the diagnostic module 174 can compare one or more of the amplitude signal 156a with the stored amplitude value 166d, the calculated threshold value 164f with the stored measured threshold value 166b, or the temperature coefficient signal 162a with the stored temperature coefficient value 166a. Any difference greater than a respective predetermined limit or criteria can be identified as a failure of the magnetic field sensor 100 of FIG. 4.
In addition, the stored safety bit 166e can be examined to determine if the last data storage was proper and uninterrupted. If not proper, then a failure of the magnetic field sensor 100 of FIG. 4 can be identified.
Any of the above failures can be so indicated in a pass/fail value 174a, which can be stored in the memory module 166, and which can be provide to other circuits inside of or outside of the magnetic field sensor 100. A stored pass/fail value 166k can be obtained at any time that the magnetic field sensor 100 is under power.
The pass/fail value 174a and the corresponding stored pass fail value 166k can merely indicate a pass or a fail. However, in other embodiments, the pass/fail value 174a and the corresponding stored pass fail value 166k can be representative of one or more specific failures.
Referring now to FIG. 6, a portion 200 of a magnetic field sensor can be the same as or similar to the similar portion 104 of the magnetic field sensor 100 of FIG. 4, but shown in greater detail. The portion 200 includes a Hall element 214 responsive to a gear 210 having gear teeth, e.g., 210a. A Hall amplifier 216 is coupled to receive signals from the Hall element and configured to generate an amplified signal. A summing node 218 is coupled to receive the amplified signal and also coupled to receive an offset trim signal from an offset trim module 222. A low pass filter 220 is coupled to receive the signal from the summing node 218 and configured to generate a filtered signal as a differential signal 220a, 220b. The differential signal 220a, 220b can be the same as or similar to the magnetic field signal 106a of FIG. 4.
The differential magnetic field signal 220a, 220b is received by an automatic gain control (AGC) control module 224. The AGC control module 224 is configured to generate a control signal received by a gain control element 226, here shown to be a variable resistance element coupled to a dual differential amplifier (DDA) 228. The dual differential amplifier (DDA) 228 can be coupled to receive the differential magnetic field signal 220a, 220b, and configured to generate a gain controlled magnetic field signal 228a. The gain controlled magnetic field signal 228a can be the same as or similar to the amplified signal 108b of FIG. 4.
A running mode detector 230 can be coupled to receive the gain controlled magnetic field signal 228a and configured to generate an output signal 230a. The running mode detector can be the same as or similar to the running mode detector 112 of FIG. 4. The running mode detector is configured to generate an output signal 230a, which can be the same as or similar to the output signal 112a of FIG. 4.
A TPOS detector 236 can include a dual differential comparator 242 coupled to receive the differential magnetic field signal 220a, 220b. The TPOS detector 236 can also include a digital to analog converter (DAC) 238 coupled to receive a calculated threshold value 234. The calculated threshold value of 234 can be the same as or similar to the calculated threshold value 120a of FIG. 4 and the calculated threshold value 164f of FIG. 5. The TPOS detector 236 can be the same as or similar to the TPOS detector 110 of FIG. 4.
In some embodiments, the TPOS detector 236 can also include a summing node 240 coupled to receive a differential output signal from the DAC 238 and coupled to receive a differential output signal from the AGC control circuit 224. The dual differential comparator 242 can be coupled to receive an output signal (an adjusted threshold signal) from the summing node 240.
For embodiments in which the calculated threshold value 234 is referenced to the differential magnetic field signal 220a, 220b, the summing node 240 and the differential signal 224a, 224b can be omitted. For embodiments in which the calculated threshold value 234 is referenced to the gain controlled magnetic field signal 228a, the summing node 240 and the differential signal 224a, 224b can apply a correction to re-reference the calculated threshold value 234 to the differential magnetic field signal 220a, 220b. 
The dual differential comparator 242 is configured to generate a TPOS output signal 242a. The output signal 242 can be the same as or similar to the output signal 110a of FIG. 4.
The output signals 242a, 230a can be received by an output switch 232, which can be the same as or similar to the output switch 114 of FIG. 4. Selection by the output switch 232 can be controlled by a control signal 246a generated by switch change logic 246. The switch change logic 246 can be the same as or similar to the switch change logic 116 of FIG. 4 and the control signal 246a can be the same as or similar to the control signal 116a of FIG. 4.
The portion 200 is configured to generate a gain signal 224a, as well as positive and negative peak signals 230a, 230b. The gain signal 224a can be the same as or similar to the gain signal 108c of FIG. 4 and the gain signal 152a of FIG. 5. The positive and negative peak signals 230a, 230b, respectively, can be the same as or similar to the positive and negative peak signals 112b, 112c, respectively, of FIG. 4 and the positive and negative peak signals 154a, 154b, respectively, of FIG. 5.
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 magnetic field sensing element responsive to a changing magnetic field and configured to generate a magnetic field signal having an amplitude;
a measured threshold module configured to generate a measured threshold signal in accordance with positive peaks and negative peaks of the magnetic field signal;
a temperature sensor configured to sense a temperature of the magnetic field sensor and configured to generate a temperature signal in accordance with the temperature;
a temperature coefficient module configured to generate a temperature coefficient signal in accordance with the temperature signal and the amplitude;
a memory device coupled to receive and configured to store, at each one of a plurality of storage times, a respective value of the temperature coefficient signal and a respective value of the measured threshold signal;
a threshold module coupled to receive, at a calculation time, a stored value of the temperature coefficient signal and a stored value of the measured threshold signal, each stored at a selected one of the plurality of storage times prior to the calculation time, coupled to receive the temperature signal, and configured to combine the received stored value of the temperature coefficient signal, the received stored value of the measured threshold signal, and the temperature signal to generate a calculated threshold value; and
a comparator coupled to receive the calculated threshold value and also coupled to receive a signal representative of the magnetic field signal, wherein the comparator is configured to compare the calculated threshold value with a signal representative of the magnetic field signal to generate an output signal.

2. The magnetic field sensor of claim 1, wherein the respective value of the measured threshold signal stored at each one of the plurality of storage times is associated with a predetermined temperature.

3. The magnetic field sensor of claim 1, wherein the respective value of the measured threshold signal stored at each one of the plurality of storage times is associated with a respective measured temperature measured at each one of the plurality of storage times,
wherein the memory device is further coupled to receive and configured to store, at each one of the plurality of storage times, a respective value of the temperature signal,
wherein the threshold module is further coupled to receive, at the calculation time, a stored value of the temperature signal stored at the selected one of the plurality of storage times prior to the calculation time, and wherein the threshold module is configured to combine the received stored value of temperature coefficient signal, the received stored value of the measured threshold signal, the received stored value of the temperature signal, and the temperature signal to generate the calculated threshold value.

4. The magnetic field sensor of claim 1, wherein the magnetic field sensor is powered off between the selected one of the plurality of storage times and the calculation time, and wherein the memory device is nonvolatile and re-writable.

5. The magnetic field sensor of claim 1, wherein the memory device is further configured to store, at each one of the plurality of storage times, a respective safety bit indicative of a proper storage of the respective value of the temperature coefficient signal and the respective value of the measured threshold signal stored at each respective one of the plurality of storage times.

6. The magnetic field sensor of claim 5, wherein the memory device is further configured to store, at times proximate to each one of the plurality of storage times, a respective backup value of the temperature coefficient signal and a respective backup value of the measured threshold signal.

7. The magnetic field sensor of claim 6, wherein the memory device is further coupled to receive and configured to store, at each one of the plurality of storage times, a respective value of the temperature signal, and wherein the memory device is coupled to receive and configured to store, at the times proximate to each one of the plurality of storage times, a respective backup value of the temperature signal.

8. The magnetic field sensor of claim 6, wherein, if the stored safety bit, stored at the selected one of the plurality of storage times, is in a first state, the threshold module is configured to generate, at the calculation time, the calculated threshold value in accordance with the received stored value of the temperature coefficient signal and the received stored value of the measured threshold signal, and wherein, if the stored safety bit stored at the selected one of the plurality of storage times is in a second different state, the threshold module is configured to receive, at the calculation time, the stored backup value of the temperature coefficient signal and the stored backup value of the measured threshold signal, each stored at a time proximate to the selected one of the plurality of storage times prior to the calculation time, and wherein the threshold module is configured to generate the calculated threshold value in accordance with the received stored backup value of the temperature coefficient signal and the received stored backup value of the measured threshold signal.

9. The magnetic field sensor of claim 5, wherein, if the stored safety bit, stored at the selected one of the plurality of storage times, is in a first state, the threshold module is configured to generate the calculated threshold value in accordance with the received stored value of the temperature coefficient signal and the received stored value of the measured threshold signal, and wherein, if the stored safety bit stored at the selected one of the plurality of storage times is in a second different state, the threshold module is configured to generate the calculated threshold value as a predetermined value.

10. The magnetic field sensor of claim 1, further comprising a diagnostic module configured to compare the temperature coefficient signal and a stored value of the temperature coefficient signal stored one of the plurality of storage times, and configured to generate a fail value if the temperature coefficient signal and the stored value of the temperature coefficient signal differ by more than a predetermined amount.

11. The magnetic field sensor of claim 1, further comprising a diagnostic module configured to compare the calculated threshold value and a stored value of the measured threshold signal stored at one of the plurality of storage times, and configured to generate a fail value if the calculated threshold value and the stored value of the measured threshold signal differ by more than a predetermined amount.

12. The magnetic field sensor of claim 1, wherein the memory device is further coupled to receive and configured to store, at each one of the plurality of storage times, a respective value of an amplitude signal, the amplitude signal representative of the amplitude of the magnetic field signal, wherein the magnetic field sensor further comprises a diagnostic module configured to compare the amplitude signal and a stored value of the amplitude signal stored at one of the plurality of storage times, and configured to generate a fail value if the amplitude signal and the stored value of the amplitude signal differ by more than a predetermined amount.

13. The magnetic field sensor of claim 1, further comprising:
an amplitude module coupled to the magnetic field sensing element and configured to generate an amplitude signal representative of the amplitude of the magnetic field signal.

14. The magnetic field sensor of claim 1, further comprising a true power on state (TPOS) detector, wherein the true power on state (TPOS) detector includes the comparator.

15. A method of sensing a magnetic field with a magnetic field sensor, comprising:
generating a magnetic field signal having an amplitude in response to a magnetic field;
generating a measured threshold signal in accordance with positive and negative peaks of the magnetic field signal;
generating a temperature signal in accordance with a temperature;
generating a temperature coefficient signal in accordance with the temperature signal and the amplitude;
storing, at each one of a plurality of storage times, a respective value of the temperature coefficient signal and a respective value of the measured threshold signal;
receiving, at a calculation time, a stored value of the temperature coefficient signal and a stored value of the measured threshold signal, each stored at a selected one of the plurality of storage times prior to the calculation time;
combining the received stored value of the temperature coefficient signal, the received stored value of the measured threshold signal, and the temperature signal to generate a calculated threshold value; and
comparing the calculated threshold value with a signal representative of the magnetic field signal to generate an output signal.

16. The method of claim 15, wherein the respective value of the measured threshold signal stored at each one of the plurality of storage times is associated with a predetermined temperature.

17. The method of claim 15, wherein the respective value of the measured threshold stored at each one of the plurality of storage times is associated with a respective measured temperature measured at each one of the plurality of storage times, the method further comprising:
storing, at each one of the plurality of storage times, a respective value of the temperature signal;
receiving, at the calculation time, a stored value of the temperature signal stored at the selected one of the plurality of storage times prior to the calculation time; and
combining the received stored value of temperature coefficient signal, the received stored value of the measured threshold signal, the received stored value of the temperature signal, and the temperature signal to generate the calculated threshold value.

18. The method of claim 15, further comprising powering off between the selected one of the plurality of storage times and the calculation time, and wherein the storing is nonvolatile and re-writable.

19. The method of claim 15, further comprising:
storing, at each one of the plurality of storage times, a respective safety hit indicative of a proper storage of the respective value of the temperature coefficient signal and the respective value of the measured threshold signal stored at each one of the plurality of storage times.

20. The method of claim 19, further comprising:
storing, at times proximate to each one of the plurality of storage times, a respective backup value of the temperature coefficient signal and a respective backup value of the measured threshold signal.

21. The method of claim 20, further comprising:
storing, at each one of the plurality of storage times, a respective value of the temperature signal; and
storing, at the times proximate to each one of the plurality of storage times, a respective backup value of the temperature signal.

22. The method of claim 20, further comprising:
receiving the stored backup value of the temperature coefficient signal and the stored backup value of the measured threshold signal, wherein, if the stored safety bit stored at the selected one of the plurality of storage times is in a first state, the generating the calculated threshold value comprises:
generating the calculated threshold value in accordance with the received stored value of the temperature coefficient signal and the received stored value of the measured threshold signal, and wherein, if the stored safety bit stored at the selected one of the plurality of storage times is in a second different state, the generating the calculated threshold value comprises:
generating the calculated threshold value in accordance with the received stored backup value of the temperature coefficient signal and the received stored backup value of the measured threshold signal.

23. The method of claim 20, wherein, if the stored safety bit stored at the selected one of the plurality of storage times is in a first state, the generating the calculated threshold value comprises:
generating the calculated threshold value in accordance with the received stored value of the temperature coefficient signal and the received stored value of the measured threshold signal, and wherein, if the stored safety bit stored at the selected one of the plurality of storage times is in a second different state, the generating the calculated threshold value comprises:
generating the calculated threshold value as a predetermined value.

24. The method of claim 15, further comprising:
comparing the temperature coefficient signal and a stored value of the temperature coefficient signal stored at one of the plurality of storage times; and
generating a fail value if the temperature coefficient signal and the stored value of the temperature coefficient signal differ by more than a predetermined amount.

25. The method of claim 15, further comprising:
comparing the calculated threshold value and a stored value of the measured threshold signal stored at one of the plurality of times; and
generating a fail value lithe calculated threshold value and the stored value of the measured threshold signal differ by more than a predetermined amount.

26. The method of claim 15, further comprising:
storing, at each one of the plurality of storage times, a respective value of an amplitude signal, the amplitude signal representative of the amplitude of the magnetic field signal;
comparing the amplitude signal and a stored value of the amplitude signal stored at one of the plurality of storage times; and
generating a fail value if the amplitude signal and the stored value of the amplitude signal differ by more than a predetermined amount.

27. The method of claim 15, further comprising:
generating an amplitude signal representative of the amplitude of the magnetic field signal.