Share this

Speed ​​measurement based on DSP with wide speed range in servo systems

2026-04-06 04:49:03 · · #1

introduction

As the requirements for the motion dynamic characteristics of servo control systems continue to increase, the demands on speed regulation accuracy, speed regulation range, and improved low-speed smoothness also increase accordingly. The speed measuring device is a crucial component of the speed closed-loop control system. For digital pulse photoelectric encoders, there are three commonly used digital speed measurement methods: m-method, t-method, and m/t-method. The m-method determines the speed based on the number of speed pulses generated by the measuring device within a specified time interval, i.e., the measurement frequency. When the motor speed is low, the number of speed pulses within the specified time is small, reducing detection accuracy; therefore, this method is suitable for high speeds. The t-method calculates the motor speed by recording the time interval between two adjacent pulses generated by the sensor, i.e., the measurement period. When the motor is running at high speed, the time interval between two adjacent pulses is extremely short, also reducing detection accuracy; therefore, this method is suitable for low speeds. The m/t-method combines the advantages of both the m-method and the t-method, suitable for both high and low speeds. However, the m/t method requires at least one timer and two counters, and it needs to capture the first pulse edge after the timing period, resulting in significant hardware and software overhead. Furthermore, it introduces interrupts, which, if program interrupt resources are limited, can negatively impact program performance if interrupt usage is excessive. This paper addresses the shortcomings of previous speed measurement methods by proposing a variable m/p method, an improvement upon the traditional t method.

Measurement principle of the variable m/p method

As shown in Figure 1, where m is the number of speed pulses obtained within the software cycle, and p is the frequency division of the system clock. The figure shows that at low speeds, the number of timing pulses between every two speed pulses is relatively large. According to the principle of the m-method speed measurement, the more counting pulses within a fixed period, the more accurate the calculated speed. However, the number of bytes in the counting register inside the DSP microcontroller is always limited; for example, a 16-bit microcontroller only allows a maximum count of 65536. At low speeds (e.g., 1 r/min), this maximum number will be far exceeded, and the measurement result will no longer be accurate. This is especially true for low-resolution photoelectric encoders. To ensure accurate speed measurement at low speeds, a appropriately small m and a large frequency division factor p should be chosen. However, at high speeds, the number of timing pulses between adjacent speed pulses is very small. For high-resolution photoelectric encoders, only one timing pulse or none may be captured between adjacent speed pulses, leading to a large error in speed measurement, or even making measurement impossible. In this case, to obtain a sufficient number of timing pulses within a fixed period, a sufficiently large m and a small frequency division factor p should be chosen, or even no frequency division should be used.

As can be seen from the above analysis, the values ​​of m and p required to measure accurate rotational speed at low and high speeds are contradictory. Therefore, in order to obtain high-precision rotational speed measurement across the entire speed range, it is necessary to change m and the frequency division factor p during the transition between low and high speeds to adapt to the measurement accuracy requirements of each speed segment. This allows the servo system to obtain a wide speed range while ensuring accuracy. This is the so-called variable m/p method, which is applicable to photoelectric encoders with different resolutions.

The calculation formula is as follows:

Where v(k) is the instantaneous speed of the motor at time k, x is the displacement per unit speed pulse, delta(t) is the time taken to rotate through displacement x; m is the number of speed pulses obtained within the software cycle, f is the resolution of the photoelectric encoder, n is the number of timing pulses, p is the frequency division factor of the system clock, and tsysoutclk is the system clock cycle of the CPU microcontroller.

Application of measurement methods on TMS320F280X series DSPs

The EQEP module in the TMS320F280X series DSP includes a unit that captures the integral edge to measure the time taken to generate a unit displacement event. This unit is often used to calculate the motor speed at low speeds. The EQEP module captures the QCTMR timer, whose timing clock is derived from a division of the DSP's system clock, sysclkout, and is often referred to as the counting clock. The division factor can be set via bits 6-4 of the QCapctl register, i.e., the CCPS bits, with configurable division values ​​of 1, 2, and 4. The values ​​for the following registers are given: 8, 16, 32, 64, 128, with corresponding CCPS values ​​of 0, 1, 2, 3, 4, 5, 6, 7. Simultaneously, bits 3-0 of the qcapctl register, i.e., the upps bit, are set to the number of rotational speed pulses to be counted, which is the fixed unit displacement. The configurable fixed rotational speed pulse counts are 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, with corresponding upps values ​​of 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11. The qctmr register counts until the motor rotates through the set fixed unit displacement. At this point, the qctmr count value is loaded into the qcprd register, and the register itself resets to zero. Simultaneously, the status bit upevnt of the qepsts status register is set to 1, indicating that a new value has been loaded into the qcprd register. When writing software, you can first check if this bit is 1 before calculating the rotational speed. This bit can be cleared to 0 by software, i.e., by writing 1 to this status bit. Figure 3 shows the relationship between the above registers:

In Figure 2, qclk represents the rotational speed pulse, while the timing pulse is not shown.

One important point to note is that the rotational speed calculated using this formula will be accurate only if the following two conditions are met:

The count value of register qcmtr does not exceed 65535;

When counting the time of a pulse displacement at a fixed speed, the direction of the motor speed does not change.

Whether the above two situations occur or not can be determined by the corresponding bit of the status register qepsts. If situation 1 occurs, the status bit coef of qepsts is set to 1; if situation 2 occurs, the status bit cdef of qepsts is set to 1.

Analysis of Experimental Results

The method studied in this paper can be applied to both low-resolution and high-resolution photoelectric encoders. For ease of explanation, a fixed-resolution photoelectric encoder with a rated speed of 3000 r/min (2500 pulses/revolution) is selected. The following speed measurements are taken under the condition of given speed and current-speed dual closed-loop control.

Constraints on the selection of m and p:

● m can only be 2^n (n can be an integer from 0 to 11);

●p can only take the value 2^n (n can be an integer from 0 to 7);

●Assuming the rotational speed is n, then they must satisfy the condition that the timing pulse register qcmtr does not overflow, i.e., the number of counts:

Update time limit for m and p: The rise time required for the speed of this servo system to increase from 0 to 1000 r/min is about 20ms. Therefore, the update time of m and p must be much less than 20ms. Otherwise, if the update of m and p cannot keep up with the change of speed, an error in speed measurement will occur. Here, the update period is selected as 1ms. Of course, if the rise time is smaller, then a faster update period of m and p can be set.

Experimental Results Analysis

Figure 3 shows the real-time speed detection curve and error curve captured by the DSP development software CCS at a given speed of 2500 r/min. In Figure 3, the y-axis "1" represents 3000 r/min, and the x-axis represents time (s). In Figure 4, the y-axis represents the ratio of the detected speed difference to the rated speed . From the experimental results curves, it can be seen that at a given speed of 2500 r/min, the measured speed is 0.8333 × 3000 = 2499.9 r/min. This shows that the detected speed is very accurate, with a maximum error of 0.067 %, meaning a maximum error of 0.067 % × 3000 = 2.01 r/min. Figure 4 shows the real-time motor speed detected using TI's DSP development software tool CCS at a given speed of 5 r/min. The maximum speed at 5 r/min is 0.00183105 * 3000 r/min, or 5.493 r/min, and the minimum speed is 0.00128174 * 3000 r/min, or 3.845 r/min.

For a photoelectric encoder with 360 pulses/revolution, the same method can be used to measure its speed response curve as shown in the figure below. Figure 5 shows the speed step response curve measured by an oscilloscope at a given speed of 1000 r/min, and Figure 6 shows the error curve at steady state speed captured by CCS software. The maximum error can be measured to be 0.00110 , which is 3.3 r/min.

The experimental results show that the speed measurement method proposed in this paper is correct, meets the expected results, is easy to implement, and has certain reference value.

Conclusion

In today's highly digitalized and integrated world, digital speed measurement methods are widely used, and analog generator speed measurement methods are gradually being replaced. Therefore, more and more devices are urgently seeking the accuracy of digital speed measurement. The speed measurement method proposed in this paper not only has the advantages of high accuracy and a wide measurement speed range, but also combines the advantages of the TMS320F280X series DSP, saving the need for external hardware frequency divider circuits and simplifying the hardware structure, thus showing great application prospects. It should be noted that digital speed measurement methods have stringent requirements on the A and B pulses sent from the photoelectric encoder to the DSP. If interference occurs during transmission, it will affect the actual measurement results. Therefore, filtering and shaping are generally required during the A and B pulse transmission to the DSP. This system uses RC filtering and a 74HC245 to shape the waveform, and the experimental results are quite satisfactory.

Read next

CATDOLL 139CM Kara (TPE Body with Hard Silicone Head)

Height: 139cm Weight: 23kg Shoulder Width: 33cm Bust/Waist/Hip: 61/56/69cm Oral Depth: 3-5cm Vaginal Depth: 3-15cm Anal...

Articles 2026-02-22
CATDOLL 132CM Luisa Silicone Doll

CATDOLL 132CM Luisa Silicone Doll

Articles
2026-02-22
CATDOLL 126CM Emelie

CATDOLL 126CM Emelie

Articles
2026-02-22
CATDOLL 135CM Sasha

CATDOLL 135CM Sasha

Articles
2026-02-22