eCAP module, system, and method for adaptive dynamic adjustment strategy
By integrating frequency monitoring, adaptive pre-division coefficient calculation, and configuration update modules into the eCAP module, the pre-division coefficients are adjusted in real time, solving the acquisition accuracy problem of the eCAP module when the frequency fluctuates, and achieving signal processing with high applicability and high reliability.
Patent Information
- Application Number
- CN202411940909.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-26
- Publication Date
- 2025-10-31
- Estimated Expiration
- 2044-12-26
AI Technical Summary
The existing eCAP module prescaler is statically configured and cannot adapt to dynamically changing signal frequencies, resulting in decreased capture accuracy when the frequency fluctuates, and thus limited applicability.
The eCAP module integrates a frequency monitoring module, an adaptive pre-division coefficient calculation module, and a configuration update module. By monitoring the input signal frequency in real time, it uses an adaptive algorithm to dynamically adjust the pre-division coefficient to meet the acquisition accuracy requirements.
It achieves high-precision capture under dynamic frequency changes, improving the applicability and reliability of the eCAP module, and is suitable for applications such as motor control, frequency measurement, and timestamp recording.
Smart Images

Figure CN119783595B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of integrated circuit design technology and relates to an eCAP module, system, and method for an adaptive dynamic adjustment strategy. Background Technology
[0002] The eCAP (Enhanced Capture) module, a key component in modern digital signal processing systems, is widely used in motor drive control, pulse width modulation (PWM) signal measurement, and time interval measurement. Its core function is to accurately capture (e.g., via an external pin) the rising or falling edge of an input signal and record the corresponding timestamp. The prescaler is a crucial parameter in the eCAP module, determining the division ratio of the input signal before capture. However, current eCAP module prescalers are typically static, remaining unchanged during system operation. This limits the eCAP module's adaptability to dynamically changing signals. Current eCAP modules are often configured with prescalers based on a known and relatively constant input signal frequency, thus failing to meet the needs of applications where the input signal frequency fluctuates dynamically, resulting in limited applicability. Summary of the Invention
[0003] To address the problems existing in the above-mentioned traditional technologies, this invention proposes an eCAP module with an adaptive dynamic adjustment strategy, a digital signal processing system, and an adaptive dynamic adjustment method for the pre-division coefficients of the eCAP module, which can significantly improve the applicability of the eCAP module.
[0004] To achieve the above objectives, the embodiments of the present invention adopt the following technical solutions:
[0005] On the one hand, an eCAP module with an adaptive dynamic adjustment strategy is provided, including a prescaler processing module, a capture register, a time base counter, a frequency monitoring module, an adaptive prescaler coefficient calculation module, and a configuration update module;
[0006] The pre-division processing module is used to divide the input signal of the external PIN according to the configured pre-division coefficient. The capture register is used to record the timestamp of the rising or falling edge of the input signal. The time base counter is used to provide the time base counter value corresponding to the rising or falling edge of the input signal. The frequency monitoring module is used to monitor the latest frequency of the input signal in real time after reading the timestamp in the capture register.
[0007] The adaptive pre-division coefficient calculation module is used to calculate the optimal pre-division coefficient that meets the preset acquisition accuracy based on the latest frequency using an adaptive algorithm. The configuration update module is used to update the pre-division coefficient currently used by the pre-division processing module to the optimal pre-division coefficient in real time.
[0008] On the other hand, a digital signal processing system is also provided, including a system chip, which integrates an eCAP module with the aforementioned adaptive dynamic adjustment strategy.
[0009] On another front, an adaptive dynamic adjustment method for the prescaler coefficients of an eCAP module is also provided. Based on the aforementioned adaptive dynamic adjustment strategy, the method for adaptive dynamic adjustment of the prescaler coefficients of the eCAP module includes the following steps:
[0010] After the system is powered on and reset, the registers inside the eCAP module are initially configured.
[0011] The edge timestamp corresponding to the input signal is loaded into the capture register according to the polarity selection of the polarity bit field of the control register ECCTL1.
[0012] If the frequency monitoring module, adaptive pre-division coefficient calculation module, and configuration update module are enabled, the frequency monitoring module immediately reads the timestamp from the capture register and begins frequency calculation. When the signal frequency obtained in this calculation is compared with the signal frequency obtained in the previous calculation and it is determined that it meets the current set capture accuracy requirements, the signal frequency obtained in this calculation is discarded and the signal frequency obtained in the previous calculation is latched.
[0013] The adaptive pre-division coefficient calculation module uses an adaptive algorithm to calculate the pre-division coefficient that meets the current capture accuracy setting based on the new input signal frequency, and submits it to the configuration update module as the new best pre-division coefficient.
[0014] After receiving the new optimal prescaler coefficient, if the prescaler coefficient used by the prescaler processing module is currently allowed to be updated, the configuration update module will immediately configure the new optimal prescaler coefficient to the prescaler coefficient bit field of the control register ECCTL1.
[0015] One of the above technical solutions has the following advantages and beneficial effects:
[0016] The aforementioned adaptive dynamic adjustment strategy for the eCAP module, system, and method integrates a frequency monitoring module, an adaptive prescaler calculation module, and a configuration update module within the eCAP module. The frequency monitoring module reads the timestamp from the capture register and monitors the latest frequency of the input signal in real time. The adaptive prescaler calculation module then uses an adaptive algorithm to calculate the optimal prescaler that meets the preset capture accuracy based on the latest frequency. Finally, the configuration update module updates the prescaler currently used by the prescaler processing module to the optimal prescaler in real time. This achieves real-time modification of the prescaler of the eCAP module based on an adaptive dynamic adjustment strategy. Without adding external components, it can not only adapt to high-precision capture of input signals with unknown constant frequencies but also ensure high-reliability capture of input signals with dynamically changing frequencies throughout the entire usage process, thereby significantly improving the applicability of the eCAP module. Attached Figure Description
[0017] To more clearly illustrate the technical solutions in the embodiments of the present invention or the conventional technology, the drawings used in the description of the embodiments or the conventional technology 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.
[0018] Figure 1 This is a schematic diagram of the overall structure of the eCAP module for an adaptive dynamic adjustment strategy in one embodiment;
[0019] Figure 2 This is a schematic diagram of the overall structure of the eCAP module for an adaptive dynamic adjustment strategy in another embodiment;
[0020] Figure 3 This is a schematic diagram illustrating the usage flow of the eCAP module for an adaptive dynamic adjustment strategy in one embodiment.
[0021] Figure 4 This is a flowchart illustrating the adaptive dynamic adjustment method for the pre-frequency division coefficients of the eCAP module in one embodiment. Detailed Implementation
[0022] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention. Unless otherwise defined, 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. The terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to limit the invention.
[0023] It should be noted that, in this document, the reference to "embodiment" means that a specific feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of the invention. The appearance of this phrase in various places in the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. Those skilled in the art will understand that the embodiments described herein can be combined with other embodiments. The term "and / or" as used in the specification and appended claims refers to any combination of one or more of the associated listed items and all possible combinations, and includes such combinations.
[0024] The embodiments of the present invention will now be described in detail with reference to the accompanying drawings.
[0025] In practical applications, the frequency of input signals often exhibits significant instability, posing a severe challenge to the configuration of prescaler coefficients in eCAP modules. Traditional fixed prescaler configuration methods struggle to simultaneously achieve accurate low-frequency signal capture and efficient high-frequency signal processing, limiting the performance of eCAP modules. In response, some research on eCAP-related technologies has emerged, such as a multi-clock signal detection device for link ports implemented using a chip-based eCAP module. This device utilizes the chip's eCAP module to detect multiple clock signals sequentially at a single link port using a high-frequency detection method, offering advantages such as simple structure and wide detection range. While this multi-clock signal detection device uses a clock switching circuit to accommodate as many capture sources as possible and a prescaler to divide the clock signal, it cannot dynamically adjust to meet actual needs when the frequency changes. It increases the selection of capture input sources by adding modules to an external single port, without considering the frequency fluctuations that the eCAP module itself may encounter during the capture process. Therefore, its pre-division coefficient configuration is essentially still static, and it cannot meet the high-precision capture requirements of the input signal when the processed input signal has large frequency fluctuations.
[0026] Based on this, this specification proposes a novel solution to address the problems of inflexible pre-division coefficient configuration and inability to adapt to different working scenarios in existing technologies. The new solution leverages the high flexibility and robustness of adaptive algorithms, enabling it to not only quickly respond to frequency changes in the input signal but also maintain stable processing performance under noise interference. Furthermore, it considers the balance between acquisition accuracy and computational efficiency to ensure overall system performance. This new solution can monitor the frequency changes of the input signal in real time and dynamically adjust the pre-division coefficients of the eCAP module based on the monitoring results and preset optimization objectives (such as acquisition accuracy and processing efficiency), thereby ensuring that the eCAP module maintains optimal acquisition performance at different signal frequencies.
[0027] In one embodiment, such as Figure 1 As shown, an eCAP module with an adaptive dynamic adjustment strategy is provided, including a prescaler processing module, a capture register, a time base counter, a frequency monitoring module, an adaptive prescaler coefficient calculation module, and a configuration update module. The prescaler processing module divides the input signal from the external PIN according to the configured prescaler coefficients. The capture register records the timestamps of the rising or falling edges of the input signal (depending on the polarity configuration). The time base counter provides the time base counter value corresponding to the rising or falling edge of the input signal. The frequency monitoring module reads the timestamps in the capture register and monitors the latest frequency of the input signal in real time. The adaptive prescaler coefficient calculation module calculates the optimal prescaler coefficient that meets the preset capture accuracy based on the latest frequency using an adaptive algorithm. The configuration update module updates the prescaler coefficients currently used by the prescaler processing module to the optimal prescaler coefficients in real time.
[0028] It is understandable that current eCAP modules, when capturing input signals from external pins, experience a decrease in capture accuracy when the frequency of the input signal changes significantly. This is because traditional eCAP modules maintain a constant prescaler coefficient after configuration. This embodiment proposes an eCAP module with an adaptive dynamic adjustment strategy. This strategy aims to intelligently and dynamically adjust the prescaler coefficient of the eCAP module based on the real-time frequency characteristics of the input signal. This maximizes the efficiency and adaptability of the eCAP module while ensuring capture accuracy, making it particularly suitable for high-precision, wide-frequency-range applications such as motor control, frequency measurement, and timestamp recording.
[0029] Specifically, the prescaler processing module, capture register, time base counter, frequency monitoring module, adaptive prescaler coefficient calculation module, and configuration update module work together to achieve adaptive frequency processing of the input signal and real-time configuration of the prescaler coefficients of the eCAP module. The entire eCAP module is responsible for capturing the rising or falling edge of the input signal, recording its timestamp, and immediately storing the timestamp in the internal capture registers CAP1~CAP4. This timestamp data will be used for subsequent signal processing and analysis. The time base counter is used to count at a fixed clock frequency according to the system clock, providing an accurate time reference for the captured event. For example, when measuring pulse width, the pulse width time can be calculated by recording the time base counter values corresponding to the rising and falling edges of the pulse. Another example is capturing the time base counter difference between two consecutive identical edges (such as rising or falling edges), and combining it with the clock frequency of the time base counter to directly obtain the pulse period. For example, in motor speed measurement, the motor speed is measured by the period of the pulse signal emitted by the photoelectric sensor.
[0030] The frequency monitoring module is responsible for real-time monitoring of the input signal frequency. The adaptive pre-division coefficient calculation module is one of the core improvements. Based on the real-time frequency information provided by the frequency monitoring module, this module uses an adaptive algorithm to calculate and determine the optimal pre-division coefficient. This optimal pre-division coefficient, relative to the initial configuration pre-division coefficient given during the eCAP module's initial configuration, can be called the adaptive pre-division coefficient. It changes with each frequency change of the input signal (this change is called the adaptive dynamic adjustment strategy). The core idea of the adaptive algorithm is to dynamically adjust the pre-division coefficient to adapt to changes in the input signal frequency. Specifically, when the input signal frequency increases, the pre-division coefficient increases accordingly; when the input signal frequency decreases, the pre-division coefficient decreases accordingly, ensuring that the pre-division coefficient always meets the preset capture accuracy requirements for the input signal after frequency changes. The adaptive algorithm ensures that the eCAP module accurately captures the timestamp of the input signal even with dynamic frequency changes.
[0031] The configuration update module is responsible for updating the calculated optimal prescaler coefficients to the prescaler processing module of the eCAP module in real time, so that the prescaler processing module can capture and process the current input signal according to the optimal prescaler coefficients. In this way, the eCAP module can immediately use the new prescaler coefficients for signal processing, ensuring the accuracy and real-time performance of the capture. During the design of the eCAP module, the frequency monitoring module, adaptive prescaler coefficient calculation module, and configuration update module can all be integrated within the eCAP module, providing only a configuration interface to the outside world.
[0032] The aforementioned eCAP module with adaptive dynamic adjustment strategy integrates a frequency monitoring module, an adaptive prescaler calculation module, and a configuration update module. The frequency monitoring module reads the timestamp from the capture register and monitors the latest frequency of the input signal in real time. The adaptive prescaler calculation module calculates the optimal prescaler that meets the preset capture accuracy based on the latest frequency using an adaptive algorithm. Finally, the configuration update module updates the prescaler currently used by the prescaler processing module to the optimal prescaler in real time. This achieves real-time modification of the prescaler of the eCAP module based on an adaptive dynamic adjustment strategy. Without adding external components, it can not only adapt to high-precision capture of input signals with unknown constant frequencies, but also ensure high-reliability capture of input signals with dynamically changing frequencies throughout the entire usage process, thereby significantly improving the applicability of the eCAP module.
[0033] In one embodiment, such as Figure 2As shown, the frequency monitoring module includes a frequency calculation module, control logic CTRL0, and a frequency register. Control logic CTRL0 reads the timestamp from the capture register and inputs it to the frequency calculation module. The frequency calculation module calculates the latest frequency of the input signal based on the timestamp and stores it in the frequency register. Correspondingly, the adaptive prescaler coefficient calculation module can be composed of control logic CTRL1 and an adaptive algorithm module.
[0034] It can be understood that the frequency monitoring module reads the timestamps from the capture registers CAP1~CAP4 through control logic CTRL0, inputs them into the frequency calculation module to calculate the latest frequency, and writes it into the FREQUENCY (frequency) register in Table 1. Control logic CTRL0 is a logic circuit in the eCAP module; in this embodiment, it is configured to read the timestamps from the capture registers and control the frequency calculation module's calculations and the writing of the latest frequency into the frequency register. Control logic CTRL1 works similarly.
[0035] Table 1
[0036]
[0037] The frequency monitoring module in this embodiment can quickly and in real time calculate the latest frequency of the input signal, thereby realizing frequency monitoring of the input signal.
[0038] In one embodiment, such as Figure 2 As shown, the frequency monitoring module also includes an accuracy calculation module. The accuracy calculation module determines whether the latest frequency calculated by the frequency calculation module meets the preset capture accuracy. If the latest frequency does not meet the preset capture accuracy, the module discards the currently calculated latest frequency and instructs the frequency register to latch the previously calculated latest frequency.
[0039] It is understood that in this embodiment, when the frequency calculation module outputs its latest calculated frequency, it can also simultaneously submit the latest calculated frequency to the accuracy calculation module. The accuracy calculation module calculates whether the current frequency meets the preset capture accuracy. The preset capture accuracy can be a single value or a range of accuracy, which can be set according to the actual application needs. The accuracy calculation module can perform capture accuracy comparison, such as comparing the latest calculated frequency with the latest calculated frequency from the previous calculation. If the latest calculated frequency meets the currently set capture accuracy requirement, then the latest calculated frequency is discarded, and the latest calculated frequency from the previous calculation is latched. That is, the frequency output to the adaptive pre-division coefficient calculation module is not updated, so that the adaptive pre-division coefficient calculation module does not generate new pre-division coefficients. This avoids over-updating the pre-division coefficients when the capture accuracy requirement is still met, thereby reducing system overhead. When determining whether the capture accuracy requirement is met based on the frequency of the input signal, the calculation relationship between the frequency of the input signal and its capture accuracy can be understood similarly to existing calculation relationships in the art, and will not be elaborated further in this specification.
[0040] In one embodiment, the frequency monitoring module may further include a polarity selection traversal table for instructing the control logic CTRL0 to select the value in the capture register as the input to the frequency calculation module based on the polarity of the polarity bit field CAPxPOL of the control register ECCTL1 initially configured for the eCAP module.
[0041] It is understood that, in this embodiment, a polarity selection traversal table can also be added to the frequency monitoring module to accurately select the value in the capture register as the input of the frequency calculation module. The polarity selection traversal table is formed by the register configuration inside the eCAP module.
[0042] Specifically, when the frequency monitoring module reads timestamps from the capture registers CAP1~CAP4 of the eCAP module, the frequency calculation is based on the timestamps of adjacent edges with the same polarity. However, in actual applications, the polarity of the four capture registers CAP1~CAP4 is uncertain. For example, capture register CAP1 may contain the timestamp of the rising edge of the capture, capture register CAP2 may contain the timestamp of the falling edge of the capture, capture register CAP3 may contain the timestamp of the falling edge of the capture, and capture register CAP4 may contain the timestamp of the rising edge of the capture. In the falling edge polarity selection mode, the frequency calculation can only use capture registers CAP2 and CAP3.
[0043] To avoid errors that may be caused by the uncertainty of human configuration, a polarity selection traversal table is added to the frequency monitoring module. This table enables the control logic CTRL0 to select, specifically and accurately, which capture register value to use as the input to the frequency calculation module to complete the frequency calculation based on the polarity of the initially configured polarity bit field CAPxPOL.
[0044] In one embodiment, such as Figure 2 As shown, the configuration update module includes a save register and control logic CTRL2. The save register is used to store the initial configuration prescaler coefficients and the optimal prescaler coefficients. The control logic CTRL2 is used to update the prescaler coefficients used before the prescaler processing module to the optimal prescaler coefficients in real time.
[0045] It is understood that the configuration update module includes a PRESERVE register to record the initial configuration prescaler value (i.e., the prescaler configured when the system powers on and completes initialization) and the adaptive prescaler. The control logic CTRL2 is a logic circuit within the eCAP module, used for behavior control of prescaler updates and read / write control of the save register. Through this embodiment's configuration update module, the prescaler currently used by the eCAP module is dynamically updated in real time.
[0046] In one embodiment, the storage registers include registers PRESERVE[4:0], PRESERVE[9:5], PRESERVE
[10] , PRESERVE
[11] , and PRESERVE[32:12]. Registers PRESERVE[4:0] are used to store the initial configuration prescaler coefficients, registers PRESERVE[9:5] are used to store the optimal prescaler coefficients, registers PRESERVE
[10] are used to select whether to enable the frequency monitoring module, the adaptive prescaler coefficient calculation module, and the configuration update module, registers PRESERVE
[11] are used to configure the configuration update module to enable the initial configuration prescaler coefficients or enable the optimal prescaler coefficients, and registers PRESERVE[32:12] are reserved bits and are not used.
[0047] As can be understood, as shown in Table 2, the save register also includes the enable or disable configurations for the frequency monitoring module, the adaptive prescaler calculation module, and the configuration update module, as well as the configuration for whether to enable new prescalers. This facilitates flexible switching between enabling and disabling the adaptive prescaler mode to adapt to more application scenarios.
[0048] Table 2
[0049]
[0050] Note: R indicates read-only, R / W indicates read-write.
[0051] In some implementations, to more clearly and intuitively demonstrate the implementation of the eCAP module of the above-mentioned adaptive dynamic adjustment strategy, such as... Figure 3 The diagram below illustrates the usage flow of the eCAP module for the aforementioned adaptive dynamic adjustment strategy:
[0052] Step 1: After the system is powered on and reset, the registers inside the eCAP module are initially configured, including the initial configuration pre-division coefficients of the pre-division processing module. The register PRESERVE
[10] is used to select whether to enable the frequency monitoring module, the adaptive pre-division coefficient calculation module, and the configuration update module. The register PRESERVE
[11] is used to indicate whether the configuration update module chooses to use the initially configured initial configuration pre-division coefficients or the optimal pre-division coefficients calculated in real time by the adaptive pre-division coefficient calculation module. When the frequency monitoring module and the adaptive pre-division coefficient calculation module are disabled, the configuration update module only uses the initially configured pre-division coefficients in the register PRESERVE[4:0], which is convenient for switching back to the initial configuration when the system starts the adaptive pre-division working mode.
[0053] Step 2: After the eCAP module's registers are initially configured and working normally, the eCAP module will load the edge timestamps corresponding to the input signals into the capture registers CAP1~CAP4 according to the polarity selection of the polarity bit field CAPxPOL (x=1, 2, 3, 4) of the control register ECCTL1.
[0054] Step 3: (1) If the adaptive pre-division coefficient calculation module is not enabled, the eCAP module will directly start capturing the timestamp of the input signal.
[0055] (2) If the frequency monitoring module, the adaptive prescaler coefficient calculation module and the configuration update module are enabled, the frequency monitoring module immediately reads the timestamp from the capture registers CAP1~CAP4 of the eCAP module and performs frequency calculation. When the signal frequency obtained in this calculation is compared with the signal frequency obtained in the previous calculation and it is determined that it meets the current set capture accuracy requirements, the signal frequency obtained in this calculation is discarded and the signal frequency obtained in the previous calculation is latched, that is, the frequency output to the adaptive prescaler coefficient calculation module is not updated.
[0056] Step 4: If the frequency monitoring module detects that the currently captured signal frequency no longer meets the current set capture accuracy requirements, and provides a new signal frequency to the adaptive pre-division coefficient calculation module, then the adaptive algorithm of the adaptive pre-division coefficient calculation module immediately calculates the pre-division coefficient that meets the current set capture accuracy based on the new input signal frequency, and submits it as the current new best pre-division coefficient to the configuration update module.
[0057] Step 5: After receiving the new optimal prescaler coefficient, if updating the prescaler coefficient used by the prescaler processing module is currently allowed, the configuration update module immediately configures the new optimal prescaler coefficient to the prescaler coefficient bit field of the control register ECCTL1 of the eCAP module to update the prescaler coefficient used by the prescaler processing module. If the configuration update module is not enabled, the configuration update module latches the new optimal prescaler coefficient in the register PRESERVE[9:5]. When the user enables the configuration update module through software during the input signal acquisition process, the configuration update module first monitors whether the frequency monitoring module has provided an update frequency request to the adaptive prescaler coefficient calculation module. If a new frequency is detected, the prescaler coefficient value latched in the configuration update module is cleared, and it waits for the adaptive prescaler coefficient calculation module to provide the new optimal prescaler coefficient before submitting the latest optimal prescaler coefficient to the prescaler coefficient bit field of the control register ECCTL1 of the eCAP module. If no frequency update request is detected, the optimal prescaler coefficients of the current PRESERVE[9:5] are directly submitted to the frequency division coefficient bit field of the control register ECCTL1 of the eCAP module.
[0058] The aforementioned eCAP module with its adaptive dynamic adjustment strategy eliminates the need for pre-calculating pre-division coefficients when capturing input signals with uncertain frequency ranges. Instead of manually configuring these coefficients, it adjusts them promptly even when capturing fluctuating input signals, allowing for more accurate capture of the input signal's timestamp according to required precision. The addition of a configuration update module ensures compatibility with existing eCAP modules' fixed parameter configurations while allowing for adaptation to adaptive dynamic adjustment strategies based on the input signal's frequency. Furthermore, it eliminates the need for additional components or interfaces to assist in input signal capture, fundamentally expanding the eCAP module's applicability. This represents a technological breakthrough from capturing relatively stable frequencies to accurately capturing dynamic frequency fluctuations, improving signal processing efficiency and accuracy, reducing repetitive manual configuration and debugging, and enhancing overall system efficiency.
[0059] In one embodiment, a digital signal processing system is also provided, including a system chip that integrates the eCAP module with the aforementioned adaptive dynamic adjustment strategy.
[0060] It is understood that the description of the system chip and other existing components of the digital signal processing system in this embodiment can be understood by referring to the same components existing in digital signal processing systems in the art, and will not be elaborated in detail here. For a detailed explanation of the eCAP module of the adaptive dynamic adjustment strategy, please refer to the corresponding limitations of the eCAP module of the adaptive dynamic adjustment strategy in the above embodiments, and will not be repeated here.
[0061] The aforementioned digital signal processing system, by applying the eCAP module with the aforementioned adaptive dynamic adjustment strategy, can effectively adapt to different application scenarios such as motor drive control, pulse width modulation (PWM) signal measurement, and time interval measurement, providing high-performance signal processing capabilities.
[0062] In one embodiment, an adaptive dynamic adjustment method for the pre-division coefficients of an eCAP module is also provided. Based on the aforementioned adaptive dynamic adjustment strategy, the eCAP module, such as... Figure 4 As shown, the adaptive dynamic adjustment method for the prescaler coefficients of this eCAP module may include the following processing steps S10 and S18:
[0063] S10: After the system power-on reset is completed, the registers inside the eCAP module are initially configured.
[0064] S12, load the edge timestamp corresponding to the input signal into the capture register according to the polarity selection of the polarity bit field of the control register ECCTL1;
[0065] S14, if the frequency monitoring module, adaptive pre-division coefficient calculation module and configuration update module are enabled, the frequency monitoring module immediately reads the timestamp from the capture register to perform frequency calculation; when the signal frequency obtained in this calculation is compared with the signal frequency obtained in the previous calculation and it is determined that it meets the current set capture accuracy requirements, the signal frequency obtained in this calculation is discarded and the signal frequency obtained in the previous calculation is latched.
[0066] S16, The adaptive pre-division coefficient calculation module uses an adaptive algorithm to calculate the pre-division coefficient that meets the current set acquisition accuracy based on the new input signal frequency, and submits it to the configuration update module as the current new best pre-division coefficient.
[0067] S18, after the configuration update module receives the new optimal prescaler coefficient, if it is currently allowed to update the prescaler coefficient used by the prescaler processing module, then the configuration update module immediately configures the new optimal prescaler coefficient to the prescaler coefficient bit field of the control register ECCTL1.
[0068] The aforementioned adaptive dynamic adjustment method for the prescaler coefficient of the eCAP module integrates a frequency monitoring module, an adaptive prescaler coefficient calculation module, and a configuration update module within the eCAP module. The frequency monitoring module reads the timestamp from the capture register and monitors the latest frequency of the input signal in real time. The adaptive prescaler coefficient calculation module then uses an adaptive algorithm to calculate the optimal prescaler coefficient that meets the preset capture accuracy based on the latest frequency. Finally, the configuration update module updates the prescaler coefficient currently used by the prescaler processing module to the optimal prescaler coefficient in real time. This achieves real-time modification of the prescaler coefficient of the eCAP module based on an adaptive dynamic adjustment strategy. Without adding external components, it can not only adapt to high-precision capture of input signals with unknown constant frequencies but also ensure high-reliability capture of input signals with dynamically changing frequencies throughout the entire usage process, thereby significantly improving the applicability of the eCAP module.
[0069] In one embodiment, the above-described method for adaptive dynamic adjustment of the pre-division coefficients of the eCAP module may further include the following steps:
[0070] If the configuration update module is not enabled, the configuration update module will latch the new optimal prescaler coefficients in register PRESERVE[9:5].
[0071] When the configuration update module is enabled, it clears the latched prescaler value when it detects that the frequency monitoring module has provided a new frequency to the adaptive prescaler calculation module.
[0072] After the adaptive prescaler calculation module provides a new optimal prescaler, the configuration update module submits the latest optimal prescaler to the prescaler bit field of the control register ECCTL1.
[0073] In one embodiment, the above-described method for adaptive dynamic adjustment of the pre-division coefficients of the eCAP module may further include the following steps:
[0074] If the frequency monitoring module, adaptive pre-division coefficient calculation module, and configuration update module are not enabled, the eCAP module will directly start capturing the timestamp of the input signal according to the initial configuration.
[0075] For a detailed explanation and limitation of the adaptive dynamic adjustment method of the prescaler coefficients in the above eCAP module, please refer to the corresponding limitation of the eCAP module of the adaptive dynamic adjustment strategy mentioned above, which will not be repeated here.
[0076] It should be understood that, although Figure 4The steps are shown sequentially as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order in which these steps are executed; they can be performed in other orders. Figure 4 At least some of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least some of the sub-steps or stages of other steps.
[0077] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided by this invention can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), memory bus DRAM (RDRAM), and interface DRAM (DRDRAM), etc.
[0078] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0079] The above embodiments merely illustrate several implementation methods of the present invention, and their descriptions are relatively specific and detailed, but they should not be construed as limiting the scope of protection of the invention. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the present invention, and all such modifications and improvements fall within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the appended claims.
Claims
1. An eCAP module with an adaptive dynamic adjustment strategy, characterized in that, It includes a prescaler processing module, a capture register, a time base counter, a frequency monitoring module, an adaptive prescaler coefficient calculation module, and a configuration update module; The pre-division processing module is used to divide the input signal of the external PIN according to the configured pre-division coefficient. The capture register is used to record the timestamp of the rising edge or falling edge of the input signal. The time base counter is used to provide the time base counter value corresponding to the rising edge or falling edge of the input signal. The frequency monitoring module is used to read the timestamp in the capture register and monitor the latest frequency of the input signal in real time. The adaptive pre-division coefficient calculation module is used to calculate the optimal pre-division coefficient that meets the preset acquisition accuracy based on the latest frequency using an adaptive algorithm. The configuration update module is used to update the pre-division coefficient currently used by the pre-division processing module to the optimal pre-division coefficient in real time. The configuration update module includes a save register and control logic CTRL2. The save register is used to store the initial configuration prescaler coefficient and the optimal prescaler coefficient. The control logic CTRL2 is used to update the prescaler coefficient used before the prescaler processing module to the optimal prescaler coefficient in real time. The storage registers include register PRESERVE[4:0], register PRESERVE[9:5], register PRESERVE[10], register PRESERVE[11] and register PRESERVE[32:12]; The register PRESERVE[4:0] is used to store the initial configuration prescaler coefficient, the register PRESERVE[9:5] is used to store the optimal prescaler coefficient, the register PRESERVE[10] is used to select whether to enable the frequency monitoring module, the adaptive prescaler coefficient calculation module and the configuration update module, the register PRESERVE[11] is used to configure the configuration update module to enable the initial configuration prescaler coefficient or enable the optimal prescaler coefficient, and the register PRESERVE[32:12] are reserved bits.
2. The eCAP module with adaptive dynamic adjustment strategy according to claim 1, characterized in that, The frequency monitoring module includes a frequency calculation module, control logic CTRL0, and a frequency register. The control logic CTRL0 is used to read the timestamp in the capture register and input it to the frequency calculation module. The frequency calculation module is used to calculate the latest frequency of the input signal based on the timestamp and then store it in the frequency register.
3. The eCAP module with adaptive dynamic adjustment strategy according to claim 2, characterized in that, The frequency monitoring module also includes a polarity selection traversal table, which is used to instruct the control logic CTRL0 to select the value in the capture register as the input of the frequency calculation module according to the polarity of the polarity bit field CAPxPOL of the control register ECCTL1 initially configured by the eCAP module.
4. A digital signal processing system, characterized in that, It includes a system chip, wherein the system chip integrates an eCAP module with the adaptive dynamic adjustment strategy as described in any one of claims 1 to 3.
5. A method for adaptive dynamic adjustment of the pre-division coefficients of an eCAP module, characterized in that, The eCAP module based on the adaptive dynamic adjustment strategy according to any one of claims 1 to 3, wherein the method for adaptive dynamic adjustment of the pre-division coefficients of the eCAP module includes the following steps: After the system is powered on and reset, the registers inside the eCAP module are initially configured. The edge timestamp corresponding to the input signal is loaded into the capture register according to the polarity selection of the polarity bit field of the control register ECCTL1. If the frequency monitoring module, adaptive pre-division coefficient calculation module, and configuration update module are enabled, the frequency monitoring module immediately reads the timestamp from the capture register to perform frequency calculation; when the signal frequency obtained in this calculation is compared with the signal frequency obtained in the previous calculation and it is determined that it meets the current set capture accuracy requirements, the signal frequency obtained in this calculation is discarded and the signal frequency obtained in the previous calculation is latched. The adaptive pre-division coefficient calculation module uses an adaptive algorithm to calculate the pre-division coefficient that meets the current capture accuracy setting based on the new input signal frequency, and submits it to the configuration update module as the current new optimal pre-division coefficient. After receiving the new optimal prescaler coefficient, if updating the prescaler coefficient used by the prescaler processing module is currently allowed, the configuration update module immediately configures the new optimal prescaler coefficient to the prescaler coefficient bit field of the control register ECCTL1.
6. The method for adaptive dynamic adjustment of the pre-division coefficients of the eCAP module according to claim 5, characterized in that, It also includes the following steps: If the configuration update module is not enabled, then the configuration update module will latch the new optimal prescaler coefficients in register PRESERVE[9:5]. When the configuration update module is enabled, the configuration update module clears the latched pre-division coefficient value when it detects that the frequency monitoring module has provided a new frequency to the adaptive pre-division coefficient calculation module. After the adaptive prescaler calculation module provides a new optimal prescaler, the configuration update module submits the latest optimal prescaler to the prescaler bit field of the control register ECCTL1.
7. The method for adaptive dynamic adjustment of the pre-division coefficients of the eCAP module according to claim 5 or 6, characterized in that, It also includes the following steps: If the frequency monitoring module, the adaptive pre-division coefficient calculation module, and the configuration update module are not enabled, the eCAP module will directly start capturing the timestamp of the input signal according to the initial configuration.
Citation Information
Patent Citations
Oscillator with automatic frequency selection function
CN117544166A
Liquid level detection device with digital output adopted
CN203758572U