A phase adaptive calibration method and apparatus for a magnetic sensor

By detecting the rotation speed of the magnet, selecting an appropriate phase calibration method, and combining coarse and fine phase adjustment, the phase error problem of the magnetic sensor at high or low speed rotation is solved, and high-precision signal calibration at different speeds is achieved.

CN116338553BActive Publication Date: 2025-10-28SENKSEMI-ELECTRONICS CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202310478883.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-04-28
Publication Date
2025-10-28
Estimated Expiration
2043-04-28

AI Technical Summary

Technical Problem

When a magnetic sensor rotates at high or low speeds, the phase error of the sine and cosine signals leads to inaccurate angle calculation results, especially at high speeds.

Method used

A phase adaptive calibration method is adopted. By detecting the rotation speed of the magnet, the appropriate phase calibration method is selected. At low speed, coarse phase adjustment calibration is used, and at high speed, coarse and fine phase adjustment calibration are combined to achieve high-precision calibration of the signal phase difference.

Benefits of technology

It can achieve high-precision calibration of the phase difference of sine and cosine signals when the magnet rotates at high or low speeds, thereby improving the accuracy of angle calculation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116338553B_ABST
    Figure CN116338553B_ABST
Patent Text Reader

Abstract

The present invention discloses a phase adaptive calibration method and device for a magnetic sensor. This method utilizes a combined calibration method of coarse phase adjustment and fine phase adjustment. Depending on the rotational speed of the magnet, the coarse phase adjustment calibration method is used to meet the angle calculation accuracy when the magnet rotates at low speeds, while the combined calibration method of coarse phase adjustment and fine phase adjustment is used to meet the angle calculation accuracy when the magnet rotates at high speeds. This method can achieve high-precision calibration of the phase difference of sine and cosine channel signals at both high and low magnet rotation speeds. Coarse phase adjustment calibrates the phase error value in units of the sampling clock, while fine phase adjustment calibrates the phase error value in units of the system clock.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of sensor technology, and in particular to a phase adaptive calibration method and apparatus for a magnetic sensor. Background Technology

[0002] A magnetic sensor has two components: a magnet and a sensor. One component can be arranged and fixed on the rotor, while the other is fixed on the stator. It is used for non-contact detection of the rotor's angular position relative to the stator. The configuration and arrangement of the magnet relative to the sensor causes it to generate a magnetic field at the sensor. This magnetic field varies as a function of the angle defining the angular position around the axis of rotation and is periodically distributed with a period length of 2π or an integer fraction of 2π.

[0003] Please refer to the following: Figures 1-3 ,in, Figure 1 This is a three-dimensional structural diagram of an embodiment of a magnetic sensor based on a Hall sensor array. Figure 2 This is a planar schematic diagram showing different magnet angles. Figure 3 The curve shows the relationship between Hall voltage and magnet angle.

[0004] like Figure 1 As shown, magnet 11 is placed perpendicular to the surface of Hall sensor array 12. The Hall sensors in Hall sensor array 12 generate Hall voltages, the value of which is proportional to the magnetic field strength at the location of the corresponding Hall sensor. Because magnet 11 is placed perpendicular to the surface of Hall sensor array 12, only the Z component of the magnetic field can be sensed. Two Z components (+B) of magnetic fields in opposite directions can be sensed. Z -B Z The sensor subtracts the Hall voltages generated by 121 and 122, which can eliminate the influence of the uniform stray field and generate a Hall signal. Figure 2 Part (a) shows the magnet 11 with an angle α of 0 around the rotation axis, while part (b) shows the magnet 11 with an angle α of greater than 0 around the rotation axis.

[0005] The Hall voltage V is proportional to the sine and cosine values ​​of the angle α. The sine and cosine channel signals generated by the Hall sensor can have phase errors due to chip manufacturing processes or external factors. The higher the magnet's rotational speed, the greater the phase error of the discrete sine and cosine values, ultimately leading to a larger error in the angle calculation result. For example... Figure 3 As shown, the position of the Cos channel signal (dashed line 31) and the position of the Sin channel signal (solid line 33) have a standard sine-cosine phase relationship. The position of the Cos channel signal (solid line 32) and the position of the Sin channel signal (solid line 33) have an actual sine-cosine phase relationship. The actual Cos channel signal experiences a phase delay, resulting in a phase error. Summary of the Invention

[0006] The purpose of this invention is to provide a phase adaptive calibration method and device for a magnetic sensor, which can achieve high-precision calibration of the phase difference of sine and cosine signals when the magnet rotates at high or low speeds.

[0007] To achieve the above objectives, the present invention provides a phase adaptive calibration method for a magnetic sensor, comprising the following steps: acquiring a Sin channel signal and a Cos channel signal; detecting and acquiring the rotational speed of a magnet; when the rotational speed of the magnet is less than or equal to a first threshold, inputting the Sin channel signal and the Cos channel signal into a first precision phase calibration channel for calibration using a first precision phase calibration method; when the rotational speed of the magnet is greater than or equal to a second threshold, inputting the Sin channel signal and the Cos channel signal into the first precision phase calibration channel for calibration using the first precision phase calibration method and obtaining a first calibration result, then inputting the first calibration result into a second precision phase calibration channel for calibration using a second precision phase calibration method; wherein, the second threshold is greater than the first threshold, and the calibration accuracy of the second precision phase calibration method is higher than the calibration accuracy of the first precision phase calibration method.

[0008] In some embodiments, the first precision phase calibration method further includes the following steps: obtaining a first phase difference between the Sin channel signal and the Cos channel signal based on a sampling clock, using the sampling period corresponding to the sampling clock as the signal jump step size and the first phase difference as the total jump value, performing phase calibration on the phase-leading signal in the Sin channel signal and the Cos channel signal, and then outputting it synchronously with the phase-delayed signal in the Sin channel signal and the Cos channel signal; the second precision phase calibration method further includes the following steps: obtaining a second phase difference between the Sin channel signal and the Cos channel signal calibrated using the first precision phase calibration method based on a system clock, using the system period corresponding to the system clock as the signal jump step size and the second phase difference as the total jump value, performing phase calibration on the phase-leading signal in the Sin channel signal and the Cos channel signal calibrated using the first precision phase calibration method, and then outputting it synchronously with the phase-delayed signal therein.

[0009] To achieve the above objectives, the present invention also provides a phase adaptive calibration device for a magnetic sensor, comprising: a first acquisition module for acquiring a Sin channel signal and a Cos channel signal; a second acquisition module for detecting and acquiring the rotational speed of a magnet; and a judgment module for inputting the Sin channel signal and the Cos channel signal into a first precision phase calibration channel for calibration using a first precision phase calibration method when the rotational speed of the magnet is determined to be less than or equal to a first threshold; the judgment module is further configured to input the Sin channel signal and the Cos channel signal into the first precision phase calibration channel for calibration using the first precision phase calibration method and obtaining a first calibration result when the rotational speed of the magnet is determined to be greater than or equal to a second threshold, and then input the first calibration result into a second precision phase calibration channel for calibration using a second precision phase calibration method; wherein the second threshold is greater than the first threshold, and the calibration accuracy of the second precision phase calibration method is higher than the calibration accuracy of the first precision phase calibration method.

[0010] This invention employs a combined phase coarse adjustment and phase fine adjustment calibration method. Based on the magnet's rotation speed, the coarse phase adjustment method is used to ensure accurate angle calculations at low magnet speeds, while the combined method of coarse and fine phase adjustments is used to ensure accurate angle calculations at high magnet speeds. This enables high-precision calibration of the phase difference between sine and cosine channel signals regardless of whether the magnet is rotating at high or low speeds. Specifically, the coarse phase adjustment calibrates the phase error value in units of the sampling clock, while the fine phase adjustment calibrates the phase error value in units of the system clock. Attached Figure Description

[0011] Figure 1 This is a three-dimensional structural schematic diagram of an embodiment of a magnetic sensor based on a Hall sensor array;

[0012] Figure 2 A planar schematic diagram showing different magnet angles;

[0013] Figure 3 The curve showing the relationship between Hall voltage and magnet angle;

[0014] Figure 4 A flowchart of a phase adaptive calibration method for a magnetic sensor provided in an embodiment of the present invention;

[0015] Figure 5 This is a schematic diagram of a first-precision phase calibration process provided in an embodiment of the present invention;

[0016] Figure 6 This is a schematic diagram of sine and cosine channel signal extension provided in an embodiment of the present invention;

[0017] Figure 7This is a schematic diagram of a second-precision phase calibration process provided in an embodiment of the present invention;

[0018] Figure 8 This is a schematic diagram of a phase adaptive calibration device for a magnetic sensor provided in an embodiment of the present invention. Detailed Implementation

[0019] The technical solutions in the embodiments of the present invention will now be clearly and completely described with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, and not all of them. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0020] One embodiment of the present invention provides a phase adaptive calibration method for a magnetic sensor, which can achieve high-precision calibration of the phase difference between sine and cosine signals when the magnet rotates at high or low speeds.

[0021] Please refer to the following: Figures 4-7 ,in, Figure 4 This is a flowchart of a phase adaptive calibration method for a magnetic sensor according to an embodiment of the present invention. Figure 5 This is a schematic diagram of a first-precision phase calibration process provided in an embodiment of the present invention. Figure 6 This is a schematic diagram of sine and cosine channel signal extension provided in an embodiment of the present invention. Figure 7 This is a schematic diagram of a second-precision phase calibration process provided in an embodiment of the present invention.

[0022] like Figure 4 As shown, the method in this embodiment includes the following steps: S1, acquiring the Sin channel signal and the Cos channel signal; S2, detecting and acquiring the rotational speed of the magnet; S3, when the rotational speed of the magnet is less than or equal to a first threshold, inputting the Sin channel signal and the Cos channel signal into a first precision phase calibration channel for calibration using a first precision phase calibration method; and S4, when the rotational speed of the magnet is greater than or equal to a second threshold, inputting the Sin channel signal and the Cos channel signal into the first precision phase calibration channel for calibration using a first precision phase calibration method and obtaining a first calibration result, then inputting the first calibration result into a second precision phase calibration channel for calibration using a second precision phase calibration method. Wherein, the second threshold is greater than the first threshold, and the calibration accuracy of the second precision phase calibration method is higher than the calibration accuracy of the first precision phase calibration method.

[0023] Regarding step S1, obtain the Sin channel signal and the Cos channel signal.

[0024] In some embodiments, the magnetic sensor is an angle magnetic sensor based on a Hall sensor array, which generates Sin channel signals and Cos channel signals.

[0025] Regarding step S2, detecting and acquiring the magnet's rotation speed: When the magnet rotates, by detecting and acquiring the magnet's rotation speed, the corresponding speed setting can be determined, and then the appropriate phase calibration method can be selected based on the speed setting.

[0026] In some embodiments, when the rotational speed of the magnet is less than or equal to a first threshold, it is determined that the magnet is rotating at a low speed (low speed setting); when the rotational speed of the magnet is greater than or equal to a second threshold, it is determined that the magnet is rotating at a high speed (high speed setting). The second threshold is greater than the first threshold. For example, the first threshold can be 1000 revolutions per minute, and the second threshold can range from 10,000 to 50,000 revolutions per minute (e.g., 20,000 revolutions per minute).

[0027] Regarding step S3, when it is determined that the rotational speed of the magnet is less than or equal to the first threshold, the Sin channel signal and the Cos channel signal are input into the first precision phase calibration channel to perform calibration using the first precision phase calibration method.

[0028] In some embodiments, the delay depth of the first precision phase calibration channel is 16, which can store 16 x 14 bits of data. Specifically, the first precision phase calibration method is phase coarse adjustment calibration, that is, when it is determined that the magnet is rotating at low speed, the phase coarse adjustment calibration method is used to adjust the input Sin channel signal and Cos channel signal to meet the angle calculation accuracy.

[0029] In some embodiments, the first precision phase calibration method further includes the following steps: obtaining the first phase difference between the Sin channel signal and the Cos channel signal based on the sampling clock; using the sampling period corresponding to the sampling clock as the signal jump step size and the first phase difference as the total jump value; performing phase calibration on the phase-leading signal in the Sin channel signal and the Cos channel signal; and then outputting it synchronously with the phase-delayed signal in the Sin channel signal and the Cos channel signal.

[0030] In some embodiments, the system clock CLK_SYS is 32 times the sampling clock CLK_SAMPLE, i.e., CLK_SYS = 32 * CLK_SAMPLE. For example, the system clock can be set to 32MHz, and the sampling clock to 1MHz. The sampling clock is the frequency at which discrete values ​​of the Sin channel signal and the Cos channel signal are sampled respectively.

[0031] In some embodiments, the method further includes: when the rising edge of the Sin channel signal is detected to cross zero, acquiring the discrete increment of the Cos channel signal; if the increment is positive, determining that the Sin channel signal is a phase-leading signal and the Cos channel signal is a phase-delayed signal; if the increment is negative, determining that the Cos channel signal is a phase-leading signal and the Sin channel signal is a phase-delayed signal. Thus, when calibration is performed using the first-precision phase calibration method, after phase calibration of the corresponding phase-leading signal, it is output synchronously with the corresponding phase-delayed signal.

[0032] In some embodiments, the step of obtaining the first phase difference between the Sin channel signal and the Cos channel signal based on the sampling clock further includes: (1) when the rising edge of the Sin channel signal is detected to cross zero, starting the Sin counter and the Cos counter, counting with the sampling clock as the counting reference and the interval period of the Sin channel signal and the Cos channel signal as the counting unit, wherein the system clock is 32 times the sampling clock; (2) when the falling edge of the Cos channel signal is detected to cross zero, the Cos counter stops counting and obtains the Cos count value; (3) when the falling edge of the Sin channel signal is detected to cross zero, the Sin counter stops counting and obtains the Sin count value; (4) obtaining the first phase difference based on the Cos count value and the Sin count value.

[0033] In some embodiments, steps (1) to (4) can be executed repeatedly to obtain multiple first phase difference values, and then the average value of the multiple first phase difference values ​​can be obtained as the target first phase difference value and stored. By calculating the first phase difference value multiple times and taking its average value, the error can be reduced and the calibration accuracy can be improved.

[0034] like Figure 5As shown, when a Sin channel signal input (S501) and a Cos channel signal input (S502) are detected; for the Sin channel signal, it is determined whether the rising edge of the Sin channel signal has crossed zero (S52); when the rising edge of the Sin channel signal has crossed zero, the Sin counter and the Cos counter are started (S53). Using the sampling clock as the counting reference and the interval period of the Sin channel signal and the Cos channel signal as the counting unit, the Sin counter counts the Sin channel signal, and the Cos counter counts the Cos channel signal. The system clock is 32 times the sampling clock. It is then determined whether the falling edge of the Sin channel signal has crossed zero (S54). When the falling edge of the Sin channel signal has crossed zero, the Sin counter stops counting (S55), and the Sin count value is obtained. For the Cos channel signal, determine whether the falling edge of the Cos channel signal has crossed zero (S56); when the falling edge of the Cos channel signal has crossed zero, the Cos counter stops counting (S57), and the Cos count value is obtained. Based on the Cos count value and the Sin count value, the phase difference between the Sin channel signal and the Cos channel signal is obtained as the first phase difference value and output (S58).

[0035] In some embodiments, the difference between the maximum and minimum values ​​among half of the Cos count and the Sin count is obtained as the first phase difference. The calculation formula is as follows:

[0036]

[0037] Where Cos_counter is the Cos count value, and Sin_counter / 2 is half of the Sin count value.

[0038] In some embodiments, the absolute value of the difference between the Cos count value and half of the Sin count value is obtained as the first phase difference value. The calculation formula is as follows:

[0039]

[0040] Regarding step S4, when the rotational speed of the magnet is determined to be greater than or equal to the second threshold, the Sin channel signal and the Cos channel signal are input into the first precision phase calibration channel to perform calibration using the first precision phase calibration method and obtain a first calibration result. Then, the first calibration result is input into the second precision phase calibration channel to calibrate the first calibration result using the second precision phase calibration method. The second threshold is greater than the first threshold (for example, the first threshold can be 1000 rpm, and the second threshold can range from 10,000 to 50,000 rpm), and the calibration accuracy of the second precision phase calibration method is higher than that of the first precision phase calibration method. The first calibration result is the Sin channel signal and the Cos channel signal calibrated using the first precision phase calibration method. The Sin channel signal and the Cos channel signal mentioned later refer to the corresponding signals calibrated using the first precision phase calibration method.

[0041] In some embodiments, the delay depth of the first precision phase calibration channel is 16, capable of storing 16x14 bit data; the delay depth of the second precision phase calibration channel is 16, capable of storing 16x14 bit data. Specifically, the first precision phase calibration method is coarse phase calibration, and the second precision phase calibration method is fine phase calibration. That is, when it is determined that the magnet is rotating at high speed, the coarse phase calibration method is used to calibrate the input Sin channel signal and Cos channel signal, and the fine phase calibration method is used to calibrate the first calibration result. The combination of the two methods satisfies the angle calculation accuracy.

[0042] In some embodiments, the second precision phase calibration method further includes the following steps: obtaining the second phase difference between the Sin channel signal and the Cos channel signal after calibration using the first precision phase calibration method with the system clock as a reference; using the system period corresponding to the system clock as the signal jump step size and the second phase difference as the total jump value, performing phase calibration on the phase-leading signal in the Sin channel signal and the Cos channel signal after calibration using the first precision phase calibration method, and then outputting it synchronously with the phase-delayed signal therein.

[0043] In some embodiments, the system clock is 32 times the sampling clock. For example, the system clock can be set to 32MHz and the sampling clock to 1MHz. The sampling clock is the frequency at which discrete values ​​of the Sin channel signal and the Cos channel signal are sampled, respectively.

[0044] In some embodiments, before calibrating the first calibration result using a second-precision phase calibration method, the method further includes: setting an extended data bit value based on the system clock; extending the data bit width of the Sin channel signal and the Cos channel signal according to the extended data bit value; and filling the channel signal data after the data bit width extension using interpolation according to the extended data bit value, so that when performing phase calibration with the system period as the signal jump step size, the corresponding channel signal data can be sampled at each system clock. For example, if the system clock is 32MHz, then the extended data bit value is set to 5 bits (32 = 2...). 5 The data width of the 14-bit Sin channel signal and the Cos channel signal is extended to 19 bits, according to 5 bits (2... 5 Data is filled evenly using interpolation.

[0045] like Figure 6As shown, clock is the sampling clock, sin_valid is the data valid flag signal of the original Sin channel signal, cos_valid is the data valid flag signal of the original Cos channel signal, the period corresponding to sin_valid is the same as the period corresponding to cos_valid, which is the system period, sin_data[13:0] is the original Sin channel signal with a data width of 14 bits, cos_data[13:0] is the original Cos channel signal with a data width of 14 bits, sin_valid_new is the data valid flag signal of the new Sin channel signal, cos_valid_new is the data valid flag signal of the new Cos channel signal, sin_data_new[18:0] is the new Sin channel signal with a data width of 19 bits, and cos_data_new[18:0] is the new Cos channel signal with a data width of 19 bits. sin_data and cos_data are periodically and continuously input at the sampling clock (1MHz as an example). Before two consecutive sin_data (or cos_data) inputs, 32 data points (including the original data) are inserted at the frequency of the system clock (32MHz as an example), uniformly filled using interpolation with two values ​​as boundaries to expand accuracy. Using interpolation, the original sin_data1 is filled into sin_data1-1, sin_data1-2, ..., sin_data1-32, and the other original sin_data2 to original sin_data14 are processed in the same way; similarly, using interpolation, the original cos_data1 is filled into cos_data1-1, cos_data1-2, ..., cos_data1-32, and the other original cos_data2 to original cos_data14 are processed in the same way. Using the above processing method, when performing phase calibration with the system period as the signal jump step size, the corresponding channel signal data can be sampled at each system clock.

[0046] In some embodiments, the method further includes: when the rising edge of the Sin channel signal is detected to cross zero, acquiring the discrete increment of the Cos channel signal; if the increment is positive, determining that the Sin channel signal is a phase-leading signal and the Cos channel signal is a phase-delayed signal; if the increment is negative, determining that the Cos channel signal is a phase-leading signal and the Sin channel signal is a phase-delayed signal. Thus, when calibration is performed using the first-precision phase calibration method, after phase calibration of the corresponding phase-leading signal, it is output synchronously with the corresponding phase-delayed signal.

[0047] In some embodiments, the step of obtaining the second phase difference between the Sin channel signal and the Cos channel signal based on the system clock further includes: when the rising edge of the Sin channel signal is detected to cross zero, using the system clock as the calculation unit, calculating the number of system clock cycles that the data valid flag signals of the Sin channel signal and the Cos channel signal differ from each other within one sampling period, and obtaining the number of system clock cycles as the second phase difference.

[0048] like Figure 7 As shown, when the Sin channel signal and the Cos channel signal are detected (S71); for the Sin channel signal, it is determined whether the increment detects the zero-crossing moment of the rising edge of the Sin channel signal (S72); when the zero-crossing moment of the rising edge of the Sin channel signal is detected, the discrete increment of the Cos channel signal is obtained, and the number of system clock cycles between the data valid flag signal of the Sin channel signal and the Cos channel signal, with the system clock as the reference, is used as the second phase difference value (S73); it is determined whether the increment is positive (S74); if the increment is positive, the Sin channel signal is determined to be positive. If the Cos channel signal is a phase-leading signal and the Sin channel signal is a phase-delayed signal, then the Sin channel signal is phase-calibrated using the system period as the signal jump step size and the second phase difference as the total jump value, and then output synchronously with the Cos channel signal (S75); if the increment is negative, then the Cos channel signal is determined to be a phase-leading signal and the Sin channel signal is a phase-delayed signal, then the Cos channel signal is phase-calibrated using the system period as the signal jump step size and the second phase difference as the total jump value, and then output synchronously with the Sin channel signal (S76).

[0049] As can be seen from the above, this embodiment employs a calibration method combining coarse and fine phase adjustment. Depending on the magnet's rotation speed, coarse phase adjustment is used to ensure accurate angle calculations at low speeds, while a combination of coarse and fine phase adjustment is used to achieve the same accuracy at high speeds. This allows for high-precision calibration of the phase difference between the sine and cosine channel signals regardless of whether the magnet is rotating at high or low speeds. Specifically, coarse phase adjustment calibrates the phase error value in units of the sampling clock, while fine phase adjustment calibrates the phase error value in units of the system clock.

[0050] Based on the same inventive concept, the present invention also provides a phase adaptive calibration device for a magnetic sensor, which can achieve high-precision calibration of the phase difference between sine and cosine signals when the magnet rotates at high or low speeds.

[0051] See also Figure 8 This is a schematic diagram of the phase adaptive calibration device for a magnetic sensor provided in an embodiment of the present invention. Figure 8 As shown, the phase adaptive calibration device for the magnetic sensor described in this embodiment includes: a first acquisition module 81, a second acquisition module 82, a judgment module 83, a first precision phase calibration channel 84, and a second precision phase calibration channel 85.

[0052] Specifically, the first acquisition module 81 is used to acquire the Sin channel signal and the Cos channel signal;

[0053] The second acquisition module 82 is used to detect and acquire the rotational speed of the magnet; the judgment module 83 is used to input the Sin channel signal and Cos channel signal into the first precision phase calibration channel 84 when it is determined that the rotational speed of the magnet is less than or equal to a first threshold, so as to perform calibration using the first precision phase calibration method; the judgment module 83 is also used to input the Sin channel signal and Cos channel signal into the first precision phase calibration channel 84 when it is determined that the rotational speed of the magnet is greater than or equal to a second threshold, so as to perform calibration using the first precision phase calibration method and obtain a first calibration result, and then input the first calibration result into the second precision phase calibration channel 85, so as to calibrate the first calibration result using the second precision phase calibration method; wherein, the second threshold is greater than the first threshold, and the calibration accuracy of the second precision phase calibration method is higher than the calibration accuracy of the first precision phase calibration method. The working method of each module can be referred to... Figures 4-7 The descriptions of the corresponding steps in the phase adaptive calibration method for the magnetic sensor shown are not repeated here.

[0054] Within the scope of this inventive concept, embodiments can be described and illustrated based on modules that perform one or more of the described functions. These modules (also referred to herein as units, etc.) can be physically implemented by analog and / or digital circuitry, such as logic gates, integrated circuits, microprocessors, microcontrollers, memory circuits, passive electronic components, active electronic components, optical components, hardwired circuits, etc., and can optionally be driven by firmware and / or software. The circuitry can, for example, be implemented in one or more semiconductor chips. The circuitry constituting a module can be implemented by dedicated hardware, or by a processor (e.g., one or more programmed microprocessors and associated circuitry), or by a combination of dedicated hardware performing some functions of the module and a processor performing other functions of the module. Without departing from the scope of this inventive concept, each module of an embodiment can be physically divided into two or more interactive and discrete modules. Similarly, without departing from the scope of this inventive concept, the modules of an embodiment can be physically combined into more complex modules.

[0055] It should be noted that the above embodiments are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. The terms "comprising" and "having," and their variations, used in this invention document are intended to cover non-exclusive inclusion. The terms "first," "second," etc., are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence, unless explicitly indicated by the context. It should be understood that such data can be used interchangeably where appropriate. Furthermore, embodiments and features within embodiments of this invention can be combined with each other unless otherwise specified. In addition, descriptions of well-known structures and technologies are omitted in the following description to avoid unnecessarily obscuring the concepts of this invention.

[0056] The above description is only a preferred embodiment of the present invention. It should be noted that those skilled in the art can make several improvements and modifications without departing from the principle of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.

Claims

1. A phase adaptive calibration method for a magnetic sensor, characterized in that, The steps include: acquiring the Sin channel signal and the Cos channel signal; detecting and acquiring the rotational speed of the magnet; When the rotational speed of the magnet is determined to be less than or equal to a first threshold, the Sin channel signal and the Cos channel signal are input into the first precision phase calibration channel to perform calibration using the first precision phase calibration method; When the rotational speed of the magnet is determined to be greater than or equal to a second threshold, the Sin channel signal and the Cos channel signal are input into the first precision phase calibration channel to perform calibration using the first precision phase calibration method and obtain a first calibration result. Then, the first calibration result is input into the second precision phase calibration channel to calibrate the first calibration result using the second precision phase calibration method. Wherein, the second threshold is greater than the first threshold, and the calibration accuracy of the second precision phase calibration method is higher than that of the first precision phase calibration method. The first precision phase calibration method further includes the following steps: obtaining the first phase difference between the Sin channel signal and the Cos channel signal based on a sampling clock, and using the sampling period corresponding to the sampling clock as the signal jump step size. Using the first phase difference as the total jump value, the phase-leading signal in the Sin channel signal and the Cos channel signal is phase-calibrated, and then output synchronously with the phase-delayed signal in the Sin channel signal and the Cos channel signal; the second precision phase calibration method further includes the following steps: obtaining the second phase difference value of the Sin channel signal and the Cos channel signal after calibration using the first precision phase calibration method with the system clock as the reference; using the system period corresponding to the system clock as the signal jump step size and the second phase difference as the total jump value, the phase-leading signal in the Sin channel signal and the Cos channel signal after calibration using the first precision phase calibration method is phase-calibrated, and then output synchronously with the phase-delayed signal therein.

2. The method according to claim 1, characterized in that, The first precision phase calibration channel has a delay depth of 16, which can store 16x14 bit data; the second precision phase calibration channel has a delay depth of 16, which can store 16x14 bit data; the system clock is 32MHz; and the sampling clock is 1MHz.

3. The method according to claim 1, characterized in that, The method further includes: when the rising edge of the Sin channel signal is detected to cross zero, obtaining the discrete value increment of the Cos channel signal; if the increment is positive, determining that the Sin channel signal is a phase-leading signal and the Cos channel signal is a phase-delayed signal; if the increment is negative, determining that the Cos channel signal is a phase-leading signal and the Sin channel signal is a phase-delayed signal.

4. The method according to claim 1, characterized in that, The step of obtaining the first phase difference between the Sin channel signal and the Cos channel signal based on the sampling clock further includes: (1) when the rising edge of the Sin channel signal is detected to cross zero, starting the Sin counter and the Cos counter, counting with the sampling clock as the counting reference and the interval period of the Sin channel signal and the Cos channel signal as the counting unit, wherein the system clock is 32 times the sampling clock; (2) when the falling edge of the Cos channel signal is detected to cross zero, the Cos counter stops counting and obtains the Cos count value; (3) when the falling edge of the Sin channel signal is detected to cross zero, the Sin counter stops counting and obtains the Sin count value; (4) obtaining the first phase difference based on the Cos count value and the Sin count value.

5. The method according to claim 4, characterized in that, The step of obtaining the first phase difference value based on the Cos count value and the Sin count value further includes: obtaining the difference between the maximum and minimum values ​​among half of the Cos count value and the Sin count value as the first phase difference value; or, obtaining the absolute value of the difference between half of the Cos count value and the Sin count value as the first phase difference value.

6. The method according to claim 4, characterized in that, The method further includes: repeatedly executing steps (1) to (4) to obtain multiple first phase difference values; obtaining the average value of the multiple first phase difference values ​​as the target first phase difference value and storing it.

7. The method according to claim 1, characterized in that, Before calibrating the first calibration result using the second precision phase calibration method, the method further includes: setting an extended data bit value based on the system clock, extending the data bit width of the Sin channel signal and the Cos channel signal according to the extended data bit value, and filling the channel signal data after the data bit width extension is performed by interpolation according to the extended data bit value, so that when performing phase calibration with the system period as the signal jump step size, the corresponding channel signal data can be sampled under each system clock.

8. The method according to claim 1, characterized in that, The step of obtaining the second phase difference between the Sin channel signal and the Cos channel signal based on the system clock further includes: when the rising edge of the Sin channel signal is detected to cross zero, using the system clock as the calculation unit, calculating the number of system clock cycles that the data valid flag signals of the Sin channel signal and the Cos channel signal differ from each other within one sampling period, and obtaining the number of system clock cycles as the second phase difference.

9. A phase adaptive calibration device for a magnetic sensor, characterized in that, include: The first acquisition module is used to acquire the Sin channel signal and the Cos channel signal; The second acquisition module is used to detect and acquire the rotational speed of the magnet; The judgment module is configured to, when determining that the rotational speed of the magnet is less than or equal to a first threshold, input the Sin channel signal and the Cos channel signal into a first precision phase calibration channel for calibration using a first precision phase calibration method; the judgment module is further configured to, when determining that the rotational speed of the magnet is greater than or equal to a second threshold, input the Sin channel signal and the Cos channel signal into the first precision phase calibration channel for calibration using the first precision phase calibration method and obtaining a first calibration result, then input the first calibration result into a second precision phase calibration channel for calibration using a second precision phase calibration method; wherein, the second threshold is greater than the first threshold, and the calibration precision of the second precision phase calibration method is higher than the calibration precision of the first precision phase calibration method; the first precision phase calibration method further includes the following steps: obtaining the Sin... The first phase difference between the Sin channel signal and the Cos channel signal is used as the signal jump step size and the first phase difference as the total jump value. After phase calibration of the phase-leading signal in the Sin channel signal and the Cos channel signal, the second precision phase calibration method is output synchronously with the phase-delayed signal in the Sin channel signal and the Cos channel signal. The second precision phase calibration method further includes the following steps: obtaining the second phase difference between the Sin channel signal and the Cos channel signal after calibration using the first precision phase calibration method with the system clock as the reference; using the system period corresponding to the system clock as the signal jump step size and the second phase difference as the total jump value, phase calibration is performed on the phase-leading signal in the Sin channel signal and the Cos channel signal after calibration using the first precision phase calibration method, and the second precision phase calibration method is output synchronously with the phase-delayed signal.

Citation Information

Patent Citations

  • Encoder control device and method, and encoder

    CN109163751A

  • The device for mixed control of the clock phase calibration of the phase domain and time domain in the clock source synchronization mechanism and its calibration method

    CN1996760A

  • Method for Detecting Errors in a Rotating Position Sensor System Having Sine and Cosine Signals

    US20200116532A1