System and method for measuring rotating speed of electronic brake booster motor

By combining an incremental photoelectric encoder with a microcontroller, high-precision measurement of the speed of an electronic brake assist motor is achieved, solving the problems of synchronization and high CPU load in existing technologies, and improving the real-time performance and accuracy of motor calibration.

CN121955441APending Publication Date: 2026-05-01SHANGHAI QIANGU AUTOMOBILE TECH CO LTD +2
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
SHANGHAI QIANGU AUTOMOBILE TECH CO LTD
Filing Date
2026-01-20
Publication Date
2026-05-01

AI Technical Summary

Technical Problem

In the existing technology, the speed measurement method of electronic brake assist motor cannot accurately acquire speed signal and synchronize with microcontroller, and the high frequency interrupt occupies too much CPU load, affecting motor calibration results and real-time performance.

Method used

An incremental photoelectric encoder is combined with a microcontroller, a general-purpose timer module, and a timer input module. Automatic data transfer is performed through a direct memory access controller, enabling the capture and transmission of both double edges of the A/B phase signals and reducing CPU load.

Benefits of technology

It achieves high-precision motor speed measurement, reduces CPU utilization, and ensures the real-time performance and accuracy of motor calibration.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121955441A_ABST
    Figure CN121955441A_ABST
Patent Text Reader

Abstract

The invention discloses a system and a method for measuring the rotating speed of an electronic brake booster motor. The system comprises an incremental photoelectric encoder, the microcontroller is electrically connected with the incremental photoelectric encoder, and a universal timer module is integrated in the microcontroller; a timer input module comprising at least a first capture channel and a second capture channel; and the direct memory access controller is electrically connected with the timer input module, and transmits the current counter value of the first capture channel and / or the second capture channel to the loop array in the memory. According to the technical scheme, the universal timer module and the timer input module are used as hardware acquisition front ends, automatic data handling is carried out through the memory access controller, and parity judgment is combined, so that full-automatic and high-precision double-edge capture and transmission of A / B phase signals of the incremental encoder are realized, a CPU (Central Processing Unit) is liberated from a traditional high-frequency interrupted load, and the cost is reduced. And the effect of extremely low CPU occupation is achieved.
Need to check novelty before this filing date? Find Prior Art

Description

An electronic brake-assisted motor speed measurement system and method Technical Field

[0001] This invention belongs to the field of vehicle motor speed calibration technology, specifically relating to an electronic brake assist motor speed measurement system and method. Background Technology

[0002] In automotive chassis systems, photoelectric encoders are mainly used for the precise measurement of motor speed and position, providing real-time feedback signals for motor control. The speed calibration of the electronic brake assist motor is one of the core aspects of electronic braking system calibration, as it directly relates to the timeliness and accuracy of braking force output.

[0003] To address the motor speed calibration problem, existing conventional solutions in the industry include directly using the speed of a servo motor coaxial with the integrated brake controller's drive motor on a motor calibration bench. However, directly using the servo motor speed cannot accurately acquire the speed signal, and it cannot be synchronized in real time with the motor control in the microcontroller, which significantly affects the motor calibration results and prevents the motor from achieving optimal performance.

[0004] Another method involves using high-frequency triggered interrupts to acquire the A and B phase signals of an incremental photoelectric encoder. However, this high-frequency interrupt consumes a very high CPU load, causing the actual software operating environment to be inconsistent with the motor calibration software operating environment, resulting in the motor calibration losing its real-time calibration function.

[0005] Therefore, it is necessary to develop an electronic brake assist motor speed measurement system and method. Summary of the Invention

[0006] The purpose of this invention is to provide an electronic brake assist motor speed measurement system and method to solve the problems in the prior art.

[0007] To address this, the present invention provides an electronic brake assist motor speed measurement system, comprising: an incremental photoelectric encoder configured to output two orthogonal pulse signals, phase A and phase B; a microcontroller electrically connected to the incremental photoelectric encoder for calibrating and calculating the speed of the incremental photoelectric encoder, and integrating within the microcontroller: a general-purpose timer module; a timer input module as a submodule of the general-purpose timer module, the timer input module including at least a first capture channel and a second capture channel; and a direct memory access controller electrically connected to the timer input module and configured to respond to a capture event of the timer input module and transmit the current counter value of the first capture channel and / or the second capture channel to a circular array in memory.

[0008] In some embodiments, the A-phase signal output terminal of the incremental photoelectric encoder is electrically connected to the first capture channel of the timer input module; the B-phase signal output terminal of the incremental photoelectric encoder is electrically connected to the second capture channel of the timer input module.

[0009] In some embodiments, the timer input module is configured to perform bilateral edge detection and capture on the input A-phase and B-phase signals on the first capture channel and the second capture channel, and update the corresponding counter value each time an edge event occurs.

[0010] In some embodiments, the phase difference between the A-phase signal and the B-phase signal is 90°, and the phase relationship between the A-phase signal and the B-phase signal is compared to determine the rotation direction of the motor.

[0011] On the other hand, a method for measuring the speed of an electronic brake-assisted motor is also provided, comprising: connecting the A-phase signal and B-phase signal of an incremental photoelectric encoder to the first capture channel and the second capture channel of a timing input module of a microcontroller, respectively; configuring the timing input module to update and increase a predetermined value by a counter when each edge is identified, and configuring the direct memory access controller to transmit the count values ​​of the capture channels corresponding to the A-phase signal and the B-phase signal to two circular arrays in memory when the edge of the A-phase signal is identified; pre-setting a fixed detection period, acquiring newly added count value groups within the fixed detection period, determining the direction based on the parity of the sum of the count value groups, and accumulating to obtain the net pulse count; and calculating the motor speed based on a preset algorithm, combined with the fixed detection period, the resolution of the incremental photoelectric encoder, and the net pulse count.

[0012] In some embodiments, the counter corresponds to a predetermined value of 1 for the update increment.

[0013] In some embodiments, within the fixed detection period, obtaining a new set of count values ​​includes: reading the number of data transfers by the direct memory access controller in the current period, and determining the current array index based on the number of data transfers; comparing the current array index with the array index recorded in the previous period; if the current array index is greater than the array index of the previous period, then determining that the new data is the data between the array index of the previous period and the current array index; if the current array index is less than the array index of the previous period, then determining that the new data is the data from the array index of the previous period to the end of the array, and the data from the beginning of the array to the current array index.

[0014] In some embodiments, the count value group includes the A-phase count value and the corresponding B-phase count value. Determining the direction and accumulating the net pulse count based on the parity of the sum of the count values ​​includes: if the sum of the count values ​​is odd, the corresponding net pulse count result is incremented by 1; if the sum of the count values ​​is even, the corresponding net pulse count result is decremented by 1.

[0015] In some embodiments, the length of the loop array is greater than twice the net pulse number.

[0016] In some embodiments, the algorithm formula for the motor speed is:

[0017] Where Tc is the fixed detection period; F is the resolution of the incremental optical encoder sensor; and N is the net pulse count.

[0018] Beneficial effects: 1. This invention uses a general-purpose timer module and a timer input module as the hardware acquisition front end, and a memory access controller for automatic data transfer, combined with parity judgment, to achieve fully automatic, high-precision double-edge capture and transmission of incremental encoder A / B phase signals. This completely frees the CPU from the traditional high-frequency interrupt load and achieves extremely low CPU usage. Attached Figure Description

[0019] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0020] Figure 1 is a schematic diagram of the architecture of the measurement system provided by the present invention.

[0021] Figure 2 is a flowchart of the measurement method provided by the present invention.

[0022] Figure 3 is a schematic diagram of the A-phase signal and the B-phase signal when the motor is rotating forward, as provided by the present invention.

[0023] Figure 4 is a schematic diagram of the DMA transport of phase A and phase B signals to the loop array when the motor rotates forward, as provided by the present invention.

[0024] Figure 5 is a schematic diagram of the A-phase signal and the B-phase signal when the motor reverses according to the present invention.

[0025] Figure 6 is a schematic diagram of the DMA transfer of phase A and phase B signals to the loop array when the motor reverses, as provided by the present invention.

[0026] Figure 7 is a schematic diagram of the A-phase signal and the B-phase signal when the motor rotates forward and reverses according to the present invention.

[0027] Figure 8 is a schematic diagram of the DMA transport of phase A and phase B signals to the loop array when the motor rotates forward and reverses, as provided by the present invention.

[0028] Figure 9 is a schematic diagram of a specific embodiment of the measurement method provided by the present invention.

[0029] Figure 10 is a schematic diagram of a specific embodiment of the measurement method provided by the present invention.

[0030] In the diagram: 100, incremental photoelectric encoder; 200, microcontroller; 300, general-purpose timer module; 400, timer input module; 500, direct memory access controller; 600, memory; 700, CPU. Detailed Implementation

[0031] The invention will be more readily understood by referring to the following detailed description of preferred embodiments and included examples. Unless otherwise specified, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains. In case of conflict, the definitions in this specification shall prevail.

[0032] As shown in Figure 1, an electronic brake assist motor speed measurement system includes: an incremental photoelectric encoder 100 configured to output two orthogonal pulse signals, phase A and phase B; a microcontroller 200 (MCU), electrically connected to the incremental photoelectric encoder 100 for calibrating and calculating the speed of the incremental photoelectric encoder 100, and integrating within the microcontroller 200: a general-purpose timer module 300 (GTM); a timer input module 400 (TIM), a submodule of the general-purpose timer module 300, specifically used for accurately capturing edge events of input signals, the timer input module 400 including at least a first capture channel and a second capture channel, the capture channels being independently configurable hardware paths within the TIM, each channel monitoring an external signal pin; and a direct memory access controller 500 (DMA), electrically connected to the timer input module 400 and configured to respond to capture events of the timer input module 400 and transfer the current counter value (CNT) of the first capture channel and / or the second capture channel to a loop array in memory 600.

[0033] Through the above technical solution, the incremental photoelectric encoder 100 serves as the signal source, and its A / B phase quadrature pulse signals are directly fed into the TIM module of the microcontroller 200. The TIM module is configured to capture both edges of the pulses, specifically the rising and falling edges, in hardware. This doubles the number of pulse events that can be captured per unit time, thereby improving the resolution and accuracy of speed measurement. Whenever a capture event occurs, the TIM latches the current value of its internal counter. The DMA controller is set to respond to this capture event and automatically move the counter value from the TIM's register to a circular array in RAM. This process requires no involvement from the CPU 700, thus completely freeing the CPU 700 from the heavy task of frequently responding to interrupts and achieving extremely low CPU 700 load.

[0034] In some embodiments, the A-phase signal output terminal of the incremental photoelectric encoder 100 is electrically connected to the first capture channel of the timer input module 400; the B-phase signal output terminal of the incremental photoelectric encoder 100 is electrically connected to the second capture channel of the timer input module 400.

[0035] The incremental photoelectric encoder 100 outputs two quadrature pulse signals, A and B phases, which are square waves with a 90-degree phase difference. These signals are independently and in parallel fed into two independent capture channels of the TIM module. This one-to-one connection ensures that the microcontroller 200 can synchronously and independently capture every edge change of the A and B phase signals. It is precisely based on this hardware synchronization that the system can accurately determine the motor's rotation direction in subsequent software processing by comparing the parity of the A and B phase counter values ​​at the same moment.

[0036] In one embodiment, the timer input module 400 is configured to perform double-edge detection and capture on the input A-phase and B-phase signals on the first capture channel and the second capture channel, and update the corresponding counter value each time an edge event occurs.

[0037] When either phase A or phase B signal undergoes a level transition (from high to low or from low to high), the corresponding acquisition channel immediately performs an acquisition action, recording the current value of the counter inside the TIM and saving it to memory 600. This process is entirely automated by hardware, extremely fast, and does not rely on CPU 700. While effectively improving data acquisition efficiency, it does not increase the operational burden on CPU 700.

[0038] In one embodiment, as shown in Figures 3, 5, and 7, the phase difference between phase A and phase B signals is 90°. The rotation direction of the motor is determined by comparing the phase relationship between phase A and phase B signals. Figure 3 shows the waveforms of phase A and phase B signals when the motor rotates forward; Figure 5 shows the waveforms of phase A and phase B signals when the motor rotates in reverse; and Figure 7 shows the waveforms of phase A and phase B signals when switching between forward and reverse rotation. The motor rotation direction can be accurately determined simply by comparing the phase relationship between phase A and phase B signals.

[0039] On the other hand, as shown in Figures 2 and 9-10, an electronic brake assist motor speed measurement method is also provided, in which the A-phase signal and B-phase signal of the incremental photoelectric encoder 100 are respectively connected to the first capture channel and the second capture channel of the timing input module of the microcontroller 200; specifically, the measurement method of this application requires the use of two TIM capture channels, corresponding to the A-phase signal and the B-phase signal respectively.

[0040] The timing input module is configured to update and increment the counter by a predetermined value, such as by 1, when each edge is detected. The direct memory access controller 500 is configured to transfer the count values ​​of the capture channels corresponding to the A-phase signal and the B-phase signal to two circular arrays in the memory 600 when the edge of the A-phase signal is detected. Specifically, the TIM is configured to a dual-edge capture mode, in which the CNT counter is incremented by 1 when each edge is detected, and then the dual-path DMA is triggered by the A-phase edge capture to transfer the CNT values ​​of the corresponding TIM channels of the A-phase and B-phase signals to two circular arrays in the memory 600 of the microcontroller 200.

[0041] For example, as shown in Figure 4, when the motor is rotating forward, the edge of phase A triggers the DMA-1 channel to transfer the CNT value of phase A to the RAM-A array. The edge of phase A triggers the DMA-2 channel to transfer the CNT value of phase B to the RAM-B array.

[0042] For example, as shown in Figure 6, when the motor reverses, the edge of phase A triggers the DMA-1 channel to transfer the phase A CNT value to the RAM-A array. The edge of phase A triggers the DMA-2 channel to transfer the phase B CNT value to the RAM-B array.

[0043] For example, as shown in Figure 8, when the motor is switching from forward to reverse rotation, the edge of phase A triggers the DMA-1 channel to transfer the phase A CNT value to the RAM-A array. The edge of phase A triggers the DMA-2 channel to transfer the phase B CNT value to the RAM-B array.

[0044] A fixed detection cycle is preset. Within the fixed detection cycle, newly added count value groups are acquired. The direction is determined based on the parity of the sum of the count value groups, and the net pulse count is obtained by accumulating them. By transforming the determination of direction into a parity check, it is simple and efficient, suitable for short-cycle tasks in microcontroller 200, and can ensure the real-time performance of the system.

[0045] For example, a fixed detection period Tc is set to 200us for data processing. In the 200us task, the current DMA transfer quantity is obtained to determine the latest data array index. The number of DMA transfer data N since the last 200us task is calculated by comparing the array indices of two consecutive 200us tasks. As shown in Table 1, when the motor rotates forward, the sum of CNTs for phases A and B is odd; as shown in Table 2, when the motor rotates in reverse, the sum of CNTs for phases A and B is even; as shown in Table 3, when the motor switches from forward to reverse, the sum of CNTs for phases A and B also changes from odd to even.

[0046] Table 1

[0047] Table 2

[0048] Table 3

[0049] In some embodiments, the count value group includes the A-phase count value and the corresponding B-phase count value. Determining the direction based on the parity of the sum of the count values ​​and accumulating them to obtain the net pulse count includes: if the sum of the count values ​​is odd, then the corresponding net pulse count result is incremented by 1; if the sum of the count values ​​is even, then the corresponding net pulse count result is decremented by 1.

[0050] For example, by iterating through the array indices corresponding to two consecutive 200us tasks, the sum of the A / B phases is calculated. If the sum is odd, add 1; if the sum is even, subtract 1, and accumulate the results. The final result is the relative position of the motor rotation within the current 200us time period. As shown in Table 4, the array index corresponding to the previous 200us task was 1, and the array index corresponding to the current 200us task is 10. By iterating through the parity of the sum of the A / B phase CNTs between (2, 10), the result is +9.

[0051] Table 4

[0052] Based on a preset algorithm, the motor speed is calculated by combining a fixed detection cycle, the resolution of the incremental photoelectric encoder 100, and the net pulse count. In some embodiments, the algorithm formula for the motor speed is:

[0053] Where Tc is the fixed detection period; F is the resolution of the incremental optical encoder sensor; and N is the net pulse count.

[0054] For example, given that Tc is 200µs and the resolution of the incremental optical encoder sensor is F pulses / revolution, since this scheme uses double-edge acquisition, the acquisition resolution is 2F / revolution. Assuming that the result of this 200µs calculation is N, where N can be positive or negative, the rotational speed S can be calculated using the above formula.

[0055] In some embodiments, acquiring a new set of count values ​​within a fixed detection period includes: reading the number of data transfers by the direct memory access controller 500 in the current period, and determining the current array index based on the number of data transfers; comparing the current array index with the array index recorded in the previous period; if the current array index is greater than the array index of the previous period, then determining that the new data is the data between the array index of the previous period and the current array index; if the current array index is less than the array index of the previous period, then determining that the new data is the data from the array index of the previous period to the end of the array, and the data from the beginning of the array to the current array index.

[0056] This technical solution ensures that no matter how fast the DMA write speed is or whether it loops back, the CPU700 can correctly and completely obtain all the new data generated in the past detection cycle, providing an accurate data basis for subsequent parity judgment and speed calculation.

[0057] As shown in Figures 9 and 10, this application provides a specific embodiment: During the hardware circuit design phase, the signal type and number of channels of the incremental photoelectric encoder 100 are analyzed, and the capture module and channels used are determined. The circuit is then built: The signal type of the incremental photoelectric encoder 100 is analyzed to be PWM type, with three phases (A / B / Z). This application uses two phases (A / B), so the number of channels is 2. The TIM module in GTM is used for PWM double-edge capture, and channels m and n are used to capture the A-phase and B-phase PWM pulse signals respectively. Specifically, the implementation description of the TIM_DMA sampling scheme is as follows: Step 103: The embedded software completes the relevant configuration of the TIM and DMA modules after initialization to meet the implementation process described in steps 103 to 106. Step 104: The embedded software configures the TIM module to perform double-edge capture and accumulate CNT when there is a PWM input.

[0058] Step 105: The embedded software configures the DMA module. After a capture is completed on the A-phase channel corresponding to the TIM module, the CNT values of the A / B phases are respectively transferred to the corresponding circular array in the RAM (Random Access Memory), and the DMA transfer quantity reload threshold is the same as the length of the circular array. The DMA transfer address reload address is the head address of the circular array.

[0059] Step 106: After the DMA completes one transfer, steps 104 and 105 are repeatedly executed. Specifically, for the implementation description of the motor speed calculation scheme for periodic tasks: Step 107: Obtain the latest data actually transferred in the current fixed detection period of 200 us: In the task, first read the number of transfers that the current DMA has completed. Since the transfer quantity of the DMA in one cycle is the same as the length of the circular array, the array subscript Index of the latest transferred data can be determined by the transfer quantity. Compare it with the array subscript Index_Last recorded in the previous 200 us task. If Index > Index_Last, it means that the circular array has not been used up, and the latest data is (Index_Last, Index]; if Index < Index_Last, it means that the circular array has been used up and new data is filled starting from the 0 address, and the latest data is (Index_Last, Index_End] + [0, Index]. This function has requirements for the design of the circular array length: for the number of pulses N generated under the maximum speed condition, the array length Length should satisfy: Length > 2N. Thus, it is ensured that the data within a 200 us cycle is not overwritten.

[0060] Step 108: When the motor rotates forward, the sum SUM of the CNT values of the A / B phases is odd, and when the motor rotates backward, the sum of the CNT values of the A / B phases is even. By circularly judging the sum of the CNT values of the A / B phases of the latest data, when SUM is odd, the judgment result Result + 1, and when SUM is even, the judgment result Result - 1. The finally obtained Result represents the number of pulses of the motor rotating forward or backward within the current 200 us, preparing for the subsequent motor speed calculation.

[0061] Step 109: Perform motor speed measurement. Given that the unit time Tc is 200 us, the number of edges captured in 200 us is N, and the acquisition resolution of the optical encoder sensor is F / circle, the motor speed S can be calculated by the M method as:

[0062] Step 110: Repeat steps 107, 108, and 109.

[0063] Finally, it should be noted that the above are merely preferred embodiments of the present invention and are not intended to limit the present invention. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions described in the foregoing embodiments or make equivalent substitutions for some of the technical features. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.

Claims

1. A speed measurement system for an electronic brake-assisted motor, characterized in that, include: The incremental photoelectric encoder is configured to output two orthogonal pulse signals, phase A and phase B. A microcontroller is electrically connected to the incremental photoelectric encoder to calculate the rotational speed of the incremental photoelectric encoder, and a general-purpose timer module is integrated inside the microcontroller. A timer input module, as a submodule of the general-purpose timer module, includes at least a first capture channel and a second capture channel; a direct memory access controller, electrically connected to the timer input module and configured to respond to a capture event of the timer input module and transfer the current counter value of the first capture channel and / or the second capture channel to a circular array in memory.

2. The measurement system according to claim 1, characterized in that, The A-phase signal output terminal of the incremental photoelectric encoder is electrically connected to the first capture channel of the timer input module; the B-phase signal output terminal of the incremental photoelectric encoder is electrically connected to the second capture channel of the timer input module.

3. The measurement system according to claim 1, characterized in that, The timer input module is configured to perform double-edge detection and capture on the input A-phase and B-phase signals on the first capture channel and the second capture channel, and update the corresponding counter value each time an edge event occurs.

4. The measurement system according to claim 1, characterized in that, The phase difference between phase A and phase B is 90°. The phase relationship between phase A and phase B is compared to determine the rotation direction of the motor.

5. A method for measuring the speed of an electronic brake-assisted motor, characterized in that, include: The A-phase signal and B-phase signal of the incremental photoelectric encoder are respectively connected to the first capture channel and the second capture channel of the timing input module of the microcontroller. The timing input module is configured to update and increase the counter by a predetermined value when each edge is identified, and the direct memory access controller is configured to transmit the count values ​​of the capture channels corresponding to the A-phase signal and the B-phase signal to two circular arrays in memory when the A-phase signal edge is identified; a fixed detection period is preset, and within the fixed detection period, the newly added count value group is acquired, the direction is determined according to the parity of the sum of the count value groups, and the net pulse number is accumulated; based on the preset algorithm, the motor speed is calculated by combining the fixed detection period, the resolution of the incremental photoelectric encoder, and the net pulse number.

6. The measurement method according to claim 5, characterized in that, The counter is updated to a predetermined value of 1.

7. The measurement method according to claim 5, characterized in that, Within the fixed detection period, acquiring the newly added count value group includes: reading the number of data transfers by the direct memory access controller in the current period, and determining the current array index based on the number of data transfers; comparing the current array index with the array index recorded in the previous period; if the current array index is greater than the array index of the previous period, then the newly added data is determined to be the data between the array index of the previous period and the current array index; if the current array index is less than the array index of the previous period, then the newly added data is determined to be the data from the array index of the previous period to the end of the array, and the data from the beginning of the array to the current array index.

8. The measurement method according to claim 5, characterized in that, The count value group includes the A-phase count value and the corresponding B-phase count value. The direction is determined by the parity of the sum of the count values ​​and the net pulse number is obtained by summing them up. If the sum of the count values ​​is odd, the corresponding net pulse number is incremented by 1; if the sum of the count values ​​is even, the corresponding net pulse number is decremented by 1.

9. The measurement method according to claim 5, characterized in that, The length of the loop array is greater than twice the net pulse count.

10. The measurement method according to claim 5, characterized in that, The algorithm formula for the motor speed is: Where Tc is the fixed detection period; F is the resolution of the incremental optical encoder sensor; and N is the net pulse count.