Pulse width modulation signal diagnosis method and device and vehicle terminal

Through the clock synchronization and mapping matrix connection between the pulse width modulation module and the input capture unit, the self-diagnosis of the pulse width modulation signal is realized, which solves the problems of high diagnostic complexity and low efficiency in the existing technology, and improves the diagnostic efficiency and accuracy. .

CN118713633APending Publication Date: 2024-09-27DEEPAL AUTOMOBILE TECH CO LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202410928062.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-11
Publication Date
2024-09-27

AI Technical Summary

Technical Problem

In the existing technology, pulse width modulation signal diagnosis has high complexity and low efficiency, and lacks effective detection methods. Especially in multi-channel situations, it is difficult to achieve efficient and accurate diagnosis.

Method used

By synchronizing the clock frequency of the pulse width modulation module and the input capture unit, using the mapping matrix table to flexibly connect the pulse signal output channel and the input capture channel, obtain the output signal parameters and compare the capture signal parameters, generate diagnostic results, and realize the pulse width Self-diagnosis of modulated signals.

Benefits of technology

The efficiency and accuracy of pulse width modulation signal diagnosis are improved, the diagnosis complexity is reduced, the connection steps are simplified, and the stability and reliability of the system are enhanced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118713633A
    Figure CN118713633A
Patent Text Reader

Abstract

The invention relates to the technical field of electronic controllers, and discloses a pulse width modulation signal diagnosis method and device and a vehicle terminal.The clock frequency of a pulse width modulation module and the clock frequency of an input capture unit are synchronized, the pulse width modulation module is used for outputting a pulse width modulation signal through a pulse signal output channel, and the input capture unit is used for capturing the pulse width modulation signal; a pulse signal output channel of a pulse width modulation module is connected with an input capturing channel of an input capturing unit, output signal parameters corresponding to pulse width modulation signals are obtained through the pulse width modulation module, parameter collection is conducted on the pulse width modulation signals input into the input capturing unit through the input capturing unit, and capturing signal parameters are obtained; comparing the output signal parameter with the capture signal parameter to generate a diagnosis result corresponding to the pulse width modulation signal according to a comparison result; by means of the method, the efficiency and accuracy of pulse width modulation signal diagnosis can be improved, and the program of pulse width modulation signal diagnosis is simplified.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of electronic controllers, and in particular to a pulse width modulation signal diagnosis method, device and vehicle terminal. Background Art

[0002] Pulse Width Modulation (PWM) is widely used in the automotive electronics industry to output square wave signals. Usually, the microcontroller unit (MCU) provides PWM output and input capture unit (ICU) acquisition functions, and is configured through the microcontroller abstraction layer (MCAL), but usually does not provide methods and interfaces for detecting whether the actual PWM output is normal. In actual applications, if you want to diagnose whether the PWM output waveform is normal, you need to capture the waveform through external devices such as oscilloscopes, logic analyzers and other tools; if you use ICU acquisition to detect whether the PWM output is normal, you need to connect multiple PWM channels with multiple ICU channels, and you also need to perform software adaptation operations, which is also cumbersome; the above two methods have problems such as low efficiency, high resource consumption, and cumbersome implementation procedures in actual applications.

[0003] Document CN106226605B proposes a PWM self-detection method, which focuses on the anti-interference ability of the circuit during the self-detection process, has high requirements for the electronic components in the recovery circuit, and does not involve self-detection schemes for multiple channels. In order to reduce the complexity of pulse width modulation signal diagnosis and improve the efficiency and accuracy of pulse width modulation signal diagnosis, this application proposes a new pulse width modulation signal diagnosis method.

[0004] It should be noted that the above content only provides background technical information related to the present invention and does not necessarily constitute prior art. Summary of the invention

[0005] In view of the above-mentioned shortcomings of the prior art, the present invention provides a pulse width modulation signal diagnosis method, device and vehicle terminal to reduce the complexity of pulse width modulation signal diagnosis and improve the efficiency and accuracy of pulse width modulation signal diagnosis.

[0006] Other features and advantages of the present invention will become apparent from the following detailed description, or may be learned in part by practice of the present invention.

[0007] According to one aspect of an embodiment of the present invention, a pulse width modulation signal diagnosis method is provided, which is applied to a vehicle terminal, wherein the vehicle terminal includes a pulse width modulation module and an input capture unit, and the method includes: synchronizing the clock frequencies of the pulse width modulation module and the input capture unit, wherein the pulse width modulation module is used to output a pulse width modulation signal through a pulse signal output channel; connecting the pulse signal output channel of the pulse width modulation module with the input capture channel of the input capture unit; acquiring output signal parameters corresponding to the pulse width modulation signal through the pulse width modulation module, and performing parameter acquisition on the pulse width modulation signal input to the input capture unit through the input capture unit to obtain capture signal parameters; and comparing the output signal parameters with the capture signal parameters to generate a diagnosis result corresponding to the pulse width modulation signal according to the comparison result.

[0008] In one embodiment of the present invention, based on the above-mentioned scheme, the clock frequencies of the pulse width modulation module and the input capture unit are synchronized, including: clock division of the microcontroller clock to obtain the divided microcontroller clock; and synchronization of the clock frequencies of the pulse width modulation module and the input capture unit by controlling the pulse width modulation module and the input capture unit to reference the divided microcontroller clock.

[0009] In one embodiment of the present invention, based on the aforementioned scheme, the pulse signal output channel of the pulse width modulation module is connected with the input capture channel of the input capture unit, including: controlling the first switches corresponding to the plurality of pulse signal output channels and the second switches corresponding to the plurality of input capture channels respectively according to a preset mapping matrix table to connect the pulse signal output channel of the pulse width modulation module with the input capture channel of the input capture unit, wherein the mapping matrix table includes the control logic when the pulse signal output channel and the input capture channel are turned on.

[0010] In one embodiment of the present invention, based on the above-mentioned scheme, the method also includes: if the number of the pulse signal output channels and the number of the input capture channels are both one, controlling the first switch corresponding to the pulse signal output channel and the second switch corresponding to the input capture channel according to the control logic in the mapping matrix table to connect the pulse signal output channel and the input capture channel; if the number of the pulse signal output channels is one and the number of the input capture channels is multiple, performing a bitwise OR operation on the mapping matrix elements corresponding to the pulse signal output channel and the input capture channel, and controlling the first switch corresponding to the pulse signal output channel and the second switch corresponding to the input capture channel according to the control logic corresponding to the operation result to connect the pulse signal output channel and the input capture channel; if the number of the pulse signal output channels is multiple, connecting the multiple pulse signal output channels to the input capture channels in turn by rotating the time slice wheel.

[0011] In one embodiment of the present invention, based on the aforementioned scheme, the method further includes: each of the pulse signal output channels and each of the input capture channels are interconnected through a star structure, the bases of the first switch and the second switch are connected to a microcontroller unit, and the conduction and cutoff of the first switch and the second switch are controlled by the I / O control of the microcontroller unit; and the I / O channels are multiplexed through an I / O expansion chip to control multiple first switches and / or second switches.

[0012] In one embodiment of the present invention, based on the aforementioned scheme, the method further includes: writing the value of each bit in the mapping matrix element into the corresponding I / O channel to obtain the corresponding control logic, so as to control the conduction or cutoff of the first switch corresponding to the pulse signal output channel and the second switch corresponding to the input capture channel according to the control logic, and connect the pulse signal output channel and the input capture channel; wherein, if the number of the input capture channels is multiple, the value of each bit in the mapping matrix element corresponding to the pulse signal output channel and the input capture channel is bitwise ORed to obtain the corresponding control logic.

[0013] In one embodiment of the present invention, based on the aforementioned scheme, a diagnostic result corresponding to the pulse width modulation signal is generated according to the comparison result, including: if the comparison result is that the output signal parameter and the capture signal parameter are the same, then the diagnostic result corresponding to the pulse width modulation signal is determined to be normal; if the comparison result is that the output signal parameter and the capture signal parameter are not the same, then the diagnostic result corresponding to the pulse width modulation signal is determined to be abnormal.

[0014] In one embodiment of the present invention, based on the aforementioned scheme, after generating a diagnostic result corresponding to the pulse width modulation signal according to the comparison result, the method further includes: if the diagnostic result corresponding to the pulse width modulation signal is abnormal, obtaining the current operating condition; determining recovery measures according to the current operating condition, the recovery measures including re-detecting the square wave signal, resetting the microcontroller unit, initializing the pulse width modulation module, and replacing the pulse signal output channel.

[0015] According to one aspect of an embodiment of the present invention, there is provided a pulse width modulation signal diagnostic device, which is applied to a vehicle terminal, wherein the vehicle terminal includes a pulse width modulation module and an input capture unit, and the device includes: a synchronization module, which is used to synchronize the clock frequencies of the pulse width modulation module and the input capture unit, wherein the pulse width modulation module is used to output the pulse width modulation signal through a pulse signal output channel; a connection module, which is used to connect the pulse signal output channel of the pulse width modulation module with the input capture channel of the input capture unit; an acquisition module, which is used to obtain output signal parameters corresponding to the pulse width modulation signal through the pulse width modulation module, and to perform parameter acquisition on the pulse width modulation signal input to the input capture unit through the input capture unit to obtain capture signal parameters; and a comparison module, which is used to compare the output signal parameters with the capture signal parameters to generate a diagnostic result corresponding to the pulse width modulation signal according to the comparison result.

[0016] The present invention also provides a vehicle terminal, which includes: one or more processors; a storage device for storing one or more programs, and when the one or more programs are executed by the one or more processors, the vehicle terminal implements the pulse width modulation signal diagnosis method as described in any of the above embodiments.

[0017] The beneficial effects of the present invention are as follows: by synchronizing the clock frequencies of the pulse width modulation module and the input capture unit, the present application eliminates the need for subsequent conversion of time units and avoids errors caused by different clock frequencies, thereby improving the efficiency and accuracy of pulse width modulation signal diagnosis; by connecting the pulse signal output channel of the pulse width modulation module with the input capture channel of the input capture unit, it is possible to achieve flexible and configurable mutual mapping connection between multiple pulse signal output channels and multiple input capture channels, and simplify the cumbersomeness of the steps for connecting the pulse signal output channel with the input capture channel, thereby reducing the complexity of pulse width modulation signal diagnosis; by acquiring output signal parameters corresponding to the pulse width modulation signal through the pulse width modulation module, and by acquiring parameters of the pulse width modulation signal of the input capture unit through the input capture unit, obtaining capture signal parameters, and comparing the output signal parameters with the capture signal parameters to generate a diagnosis result corresponding to the pulse width modulation signal according to the comparison result, thereby improving the stability and reliability of system operation.

[0018] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] The drawings herein are incorporated into the specification and constitute a part of the specification, showing embodiments consistent with the present application, and together with the specification, are used to explain the principles of the present application. Obviously, the drawings described below are only some embodiments of the present application, and for those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative work. In the drawings:

[0020] Figure 1 is a schematic diagram of an exemplary system architecture shown in an exemplary embodiment of the present application;

[0021] Figure 2 is a flow chart of a pulse width modulation signal diagnosis method shown in an exemplary embodiment of the present application;

[0022] Figure 3 is a schematic diagram illustrating channel connection of a pulse width modulation signal diagnosis method according to an exemplary embodiment of the present application;

[0023] Figure 4 is a schematic diagram of a mapping matrix table of a pulse width modulation signal diagnosis method shown in an exemplary embodiment of the present application;

[0024] Figure 5 is a flow chart of a pulse width modulation signal diagnosis method shown in another exemplary embodiment of the present application;

[0025] Figure 6 is a block diagram of a pulse width modulation signal diagnosis device shown in an exemplary embodiment of the present application;

[0026] Figure 7 A schematic diagram of the structure of a computer system suitable for implementing an electronic device of an embodiment of the present invention is shown. DETAILED DESCRIPTION

[0027] The following will describe the embodiments of the present invention with reference to the accompanying drawings and preferred embodiments. Those skilled in the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present invention. It should be understood that the preferred embodiments are only for illustrating the present invention, not for limiting the scope of protection of the present invention.

[0028] It should be noted that the illustrations provided in the following embodiments are only used to illustrate the basic concept of the present invention in a schematic manner, and thus the illustrations only show components related to the present invention rather than being drawn according to the number, shape and size of components in actual implementation. In actual implementation, the type, quantity and proportion of each component may be changed arbitrarily, and the component layout may also be more complicated.

[0029] In the following description, numerous details are discussed to provide a more thorough explanation of the embodiments of the present invention. However, it is obvious to those skilled in the art that the embodiments of the present invention can be implemented without these specific details. In other embodiments, well-known structures and devices are shown in the form of block diagrams rather than in detail to avoid making the embodiments of the present invention difficult to understand.

[0030] First of all, it should be explained that pulse width modulation (PWM) is an analog control method. Its core principle is to control the output of the analog circuit by changing the width or duty cycle of the pulse. The PWM control method mainly controls the on and off of the switching devices of the inverter circuit so that the output end obtains a series of pulses with equal amplitudes but inconsistent widths. These pulses are used to replace the sine wave or the required waveform, that is, multiple pulses are generated in half a cycle of the output waveform so that the equivalent voltage of each pulse is a sine wave. By modulating the width of each pulse according to certain rules, the output voltage of the inverter circuit can be changed, and the output frequency can also be changed.

[0031] Microcontroller Unit (MCU), also known as single chip microcomputer or single chip microcomputer, is a chip-level computer that appropriately reduces the frequency and specifications of the central processing unit (CPU), and integrates memory, timer, USB, A / D conversion, UART, PLC, DMA and other peripheral interfaces, and even LCD driver circuits on a single chip to make different combinations of control for different applications. MCU can be seen in mobile phones, PC peripherals, remote controls, automotive electronics, industrial stepper motors, robot arm control, etc.

[0032] Input Capture Unit (ICU) is a special term. ICU driver can complete the functions of demodulating PWM signals, counting pulses, measuring frequency and duty cycle, and generating simple interrupts and wake-up interrupts.

[0033] Clock division is a technique used to reduce the frequency of a clock signal. This is very common in electronic systems because different circuit components may require clock signals of different frequencies to work properly. Clock division can be achieved in a variety of ways, including integer power of 2 division, even division, odd division, fractional division, etc. In actual applications, which division method is chosen depends on the specific needs and system requirements.

[0034] The bitwise OR operator "|" is a binary operator. Its function is to OR the corresponding binary bits of the two numbers involved in the operation. As long as one of the two corresponding binary bits is 1, the result bit is 1. When the number involved in the operation is negative, the two numbers involved appear in the complement code.

[0035] Figure 1 It is a schematic diagram of an exemplary system architecture shown in an exemplary embodiment of the present application.

[0036] Reference Figure 1 As shown, the system architecture may include an electronic control unit 101 and an external connection circuit 102. The electronic control unit 101 may be a single chip microcomputer or the like. Relevant technicians may synchronize the clock frequencies of the pulse width modulation module and the input capture unit in the electronic control unit 101. The electronic control unit 101 is used to perform pulse width modulation, output a square wave signal according to preset parameters, and collect the input square wave signal through the input capture unit to obtain the parameters of the capture signal. The external connection circuit 102 is used to connect multiple square wave output peripherals and multiple frequency acquisition peripherals on the physical circuit, and realize the switch control of whether the channel is turned on or not through the digital output peripheral of the electronic control unit 101. The electronic control unit 101 compares the parameters of the output square wave signal with the parameters of the capture signal, that is, the electronic control unit 101 compares the output signal parameters with the capture signal parameters to obtain the diagnostic result corresponding to the pulse width modulation signal according to the comparison result. It should be noted that the electronic control unit 101 and the external connection circuit 102 provided in this embodiment are only an example and should not bring any limitation to the function and scope of use of the embodiment of the present invention.

[0037] It should be noted that the pulse width modulation signal diagnosis method provided in the embodiment of the present application is generally executed by the electronic control unit 101 , and accordingly, the pulse width modulation signal diagnosis device is generally disposed in the electronic control unit 101 .

[0038] Figure 2 is a flow chart of a pulse width modulation signal diagnosis method shown in an exemplary embodiment of the present application. The pulse width modulation signal diagnosis method can be executed by a computing and processing device. The computing and processing device can be Figure 1 The electronic control unit 101 shown in FIG. Figure 2As shown, the pulse width modulation signal diagnosis method at least includes steps S210 to S240, which are described in detail as follows:

[0039] In step S210, the clock frequencies of the pulse width modulation module and the input capture unit are synchronized.

[0040] In one embodiment of the present application, the pulse width modulation module is used to output a pulse width modulation signal through a pulse signal output channel.

[0041] In one embodiment of the present application, a microcontroller clock is divided to obtain a divided microcontroller clock; the clock frequencies of the pulse width modulation module and the input capture unit are synchronized by controlling the pulse width modulation module and the input capture unit to reference the divided microcontroller clock.

[0042] In this embodiment, by configuring the frequency division of the MCU clock, i.e., the microcontroller clock, and the reference of the PWM drive, i.e., the pulse width modulation module, and the ICU drive, i.e., the input capture unit, to the MCU clock in the software, the clock frequency of the ICU drive is made consistent with the clock frequency of the PWM drive to be diagnosed, wherein the reference of the PWM drive and the ICU drive to the MCU clock can be specifically: the PWM drive and the ICU drive reference the same clock, or the frequencies of the clocks referenced by the two modules are made consistent. The advantage of clock synchronization is that when the parameters such as the cycle and high-level time of the PWM output waveform and the waveform collected by the ICU are expressed in Ticks (the number of timing cycles, a counting unit directly related to the system clock or a specific clock source), the time length represented by each Ticks in the two modules is consistent, and the subsequent modules do not need to convert the Ticks to the time unit, and can diagnose whether the PWM output waveform is normal by comparing the Ticks alone, and avoid the error caused by the different time represented by the two Ticks, thereby improving the efficiency and stability of the system.

[0043] In step S220, the pulse signal output channel of the pulse width modulation module is connected to the input capture channel of the input capture unit.

[0044] In one embodiment of the present application, first switches corresponding to multiple pulse signal output channels and second switches corresponding to multiple input capture channels are controlled respectively according to a preset mapping matrix table to connect the pulse signal output channel of the pulse width modulation module with the input capture channel of the input capture unit, wherein the mapping matrix table includes control logic when the pulse signal output channel and the input capture channel are turned on.

[0045] In this embodiment, the mapping matrix is ​​combined with the logic circuit to realize the flexible configuration of the conduction between the PWM output channel, i.e., the pulse signal output channel, and the ICU acquisition channel, i.e., the input capture channel. For example, the mapping matrix Map, i.e., the mapping matrix table, defines the control logic when the i-th (i∈{0,1,2,...,MaxPwmChlNum-1}, MaxPwmChlNum is the number of PWM output channels) PWM output channel and the j-th (j∈{0,1,2,...,MaxIcuChlNum-1}, MaxIcuChlNum is the number of ICU acquisition channels) ICU acquisition channel are turned on. If the output of the i-th PWM channel is to be collected by the j-th ICU channel, the subsequent MCU only needs to control the corresponding transistor switch according to the control logic stored in the mapping matrix Map(i,j) to realize the connection between the corresponding PWM channel and the ICU channel on the physical link. Preferably, both the first switch and the second switch are transistor switches. It should be noted that in this embodiment, the first switch and the second switch can be set to other types of switches according to actual needs, and the present application does not limit this.

[0046] In one embodiment of the present application, if the number of pulse signal output channels and the number of input capture channels are both one, the first switch corresponding to the pulse signal output channel and the second switch corresponding to the input capture channel are controlled according to the control logic in the mapping matrix table to connect the pulse signal output channel and the input capture channel; if the number of pulse signal output channels is one and the number of input capture channels is multiple, the mapping matrix elements corresponding to the pulse signal output channel and the input capture channel are bitwise OR-operated, and the first switch corresponding to the pulse signal output channel and the second switch corresponding to the input capture channel are controlled according to the control logic corresponding to the operation result to connect the pulse signal output channel and the input capture channel; if the number of pulse signal output channels is multiple, the multiple pulse signal output channels are respectively connected to the input capture channels in turn by rotating the time slice wheel.

[0047] In this embodiment, if any PWM output channel is to be collected by any number of ICU channels, the mapping matrix Map of the PWM channel and the ICU channel is queried to obtain the corresponding channel mapping control logic. The MCU controls the corresponding transistor switch through the DIO module according to the obtained channel mapping control logic to achieve flexible and configurable conduction of the corresponding PWM channel and ICU channel. The DIO (Digital Input / Output) module is mainly used to control the input and output of digital signals, allowing the MCU to interact with external devices or circuits for digital signals, such as reading the switch state, controlling the switch state, etc.

[0048] In this embodiment, if the output of the i-th PWM channel is to be collected by the j-th ICU channel, the subsequent MCU only needs to control the corresponding transistor switch according to the control logic stored in the mapping matrix Map(i,j) to realize the connection between the corresponding PWM channel, i.e., the pulse signal output channel, and the ICU channel, i.e., the input capture channel, on the physical link. If the same PWM output channel is to be collected by multiple ICU channels, it is only necessary to perform a binary OR operation on the corresponding multiple mapping matrix element values, and feed back to the MCU to pull up and down the corresponding transistor switch ports, so as to realize the connection between a single PWM output channel and multiple ICU acquisition channels on the physical link. In particular, multiple PWM channels cannot be turned on at the same time, and the sequential turning on and diagnosis of multiple PWM channels can be realized by rotating the time slice wheel.

[0049] In one embodiment of the present application, each pulse signal output channel and each input capture channel are interconnected through a star structure, each pulse signal output channel has a first switch for controlling conduction and cutoff, each input capture channel has a second switch for controlling conduction and cutoff, the bases of the first switch and the second switch are both connected to a microcontroller unit, and the conduction and cutoff of the first switch and the second switch are controlled by the I / O control of the microcontroller unit; the I / O channel is multiplexed through the I / O expansion chip to control multiple first switches and / or second switches.

[0050] In this embodiment, the specific PWM channel and ICU channel conduction circuit logic connection method is as follows: Figure 3 shown. Figure 3 is a schematic diagram illustrating channel connection of a pulse width modulation signal diagnosis method according to an exemplary embodiment of the present application. Figure 3 As shown, each PWM channel and each ICU channel are interconnected through a star structure. Each PWM channel and each ICU channel has a transistor switch that controls conduction and cutoff. The base of the transistor is connected to the MCU. Through the I / O control of the MCU, the conduction and cutoff of the transistor can be controlled. In this way, the conduction of any PWM output channel and any ICU acquisition channel can be realized, and the channel of any PWM output channel and any number of ICU acquisition channels can also be realized, that is, the mapping relationship between the PWM channel and the ICU channel is flexible and configurable. The output of a single PWM channel is collected by multiple ICU channels, which can improve the precision and accuracy of the collection. At the same time, this method has high requirements on the number of I / O ports in the MCU, and the I / O channels can be reused through the I / O expansion chip to achieve the purpose of controlling multiple transistor switches.

[0051] In one embodiment of the present application, the value of each bit in the mapping matrix element is written into the corresponding I / O channel to obtain the corresponding control logic, so as to control the conduction or cutoff of the first switch corresponding to the pulse signal output channel and the second switch corresponding to the input capture channel according to the control logic, and connect the pulse signal output channel and the input capture channel; wherein, if there are multiple input capture channels, the value of each bit in the mapping matrix element corresponding to the pulse signal output channel and the input capture channel is bitwise ORed to obtain the corresponding control logic.

[0052] In this embodiment, refer to Figure 4 As shown, Figure 4 It is a schematic diagram of a mapping matrix table of a pulse width modulation signal diagnosis method shown in an exemplary embodiment of the present application. Figure 4 The data structure that describes the mapping relationship between PWM channels and ICU channels. When used to describe the mapping relationship between I PWM channels and J ICU channels, the dimension of the mapping matrix is ​​Map{I,J}. The mapping matrix element Map(i,j) describes the diagnostic logic when the i-th PWM channel and the j-th ICU channel are turned on, such as Figure 4 As shown, according to the value of each bit in the mapping matrix element Map(i,j), the corresponding I / O channel is written to realize the control of the corresponding transistor switch on / off step logic, thereby realizing the connection between any PWM channel and any ICU channel. In particular, when the output of the pth PWM channel PWM Channel p is collected by multiple ICU channels (ICU Channel q, w, e...), it is only necessary to perform a bitwise OR operation on the mapping matrix element Map(p,q) with Map(p,w), Map(p,e), etc. to obtain the corresponding control logic. For example: the mapping matrix element Map(1,2) describes the MCU control logic when the PWM channel 1 (PWM Ch1) and ICU channel 2 (ICU Ch2) are turned on. If the output waveform of PWM Ch1 is to be collected by ICU Ch2, the element value of Map(1,2) is obtained and the corresponding MCU DIO channel is set bit by bit (the value of bit0 is written to DIO Ch0, the value of bit1 is written to DIOCh1, ...), so that PWM Ch1 and ICU Ch2 can be turned on in the link. If PWM Ch1 is to be collected by ICU Ch2 and ICU Ch3 at the same time, perform a binary OR operation on the values ​​of Map(1,2) and Map(1,3), and set the corresponding MCU DIO channel bit by bit according to the result of the OR operation. This will enable the PWM Ch1 output square wave to be collected by ICU Ch2 and ICU Ch3 at the same time.

[0053] In step S230, the output signal parameters corresponding to the pulse width modulation signal are acquired through the pulse width modulation module, and the pulse width modulation signal input to the input capture unit is collected through the input capture unit to obtain the captured signal parameters.

[0054] The output signal parameters and the capture signal parameters include but are not limited to pulse period, duty cycle, frequency and polarity.

[0055] In one embodiment of the present application, parameters related to the square wave signal in the PWM drive and ICU drive control registers are obtained respectively, such as pulse period, duty cycle, frequency, polarity, etc.

[0056] In step S240, the output signal parameter is compared with the captured signal parameter to generate a diagnosis result corresponding to the pulse width modulation signal according to the comparison result.

[0057] In one embodiment of the present application, by comparing the output signal parameters and the capture signal parameters, it is determined whether the output signal parameters and the capture signal parameters are equal, and whether the pulse wave output is normal is diagnosed. If the comparison result is that the output signal parameters and the capture signal parameters are the same, the diagnosis result corresponding to the pulse width modulation signal is determined to be normal; if the comparison result is that the output signal parameters and the capture signal parameters are not the same, the diagnosis result corresponding to the pulse width modulation signal is determined to be abnormal.

[0058] In one embodiment of the present application, after generating a diagnostic result corresponding to the pulse width modulation signal based on the comparison result, if the diagnostic result corresponding to the pulse width modulation signal is abnormal, the current operating condition is obtained; recovery measures are determined based on the current operating condition, and the recovery measures include re-detecting the square wave signal, resetting the microcontroller unit, initializing the pulse width modulation module, and replacing the pulse signal output channel.

[0059] In one embodiment of the present application, the pulse width modulation signal diagnosis system at least includes a clock synchronization module, a channel mapping module, and a result comparison and fault recovery module. When the ICU acquisition module of the MCU is used to detect the PWM wave output, the clock frequency of the PWM drive and the ICU drive is first synchronized through the clock synchronization module; then, through the channel mapping module, the MCU controls the mapping of the PWM channel to be diagnosed and the ICU channel and the connection on the physical link; finally, through the result comparison and recovery module, the pulse width, duty cycle, frequency, polarity and other information of the PWM drive output and the ICU acquisition drive are obtained respectively, and by comparing whether the information is equal, the output of the PWM channel is detected to be faulty, and corresponding processing is performed according to the diagnosis result.

[0060] In this embodiment, in the clock synchronization module, by configuring the frequency division of the MCU clock in the software, and the reference of the MCU clock by the PWM drive and the ICU drive, the clock frequency of the ICU drive is kept consistent with the clock frequency of the PWM drive to be diagnosed. The advantage of clock synchronization is that when the PWM output waveform and the period, high level time and other parameters of the waveform collected by the ICU are expressed in Ticks, the time length represented by each Ticks in the two modules is consistent, and the subsequent modules do not need to convert the Ticks to the time unit. Only by comparing the Ticks, it can be diagnosed whether the PWM output waveform is normal, and the error caused by the different time represented by the two Ticks is avoided, thereby improving the efficiency and stability of the system.

[0061] In this embodiment, in the channel mapping module, the mapping matrix and the logic circuit are combined to realize flexible and configurable conduction between the PWM output channel and the ICU acquisition channel. The mapping matrix Map defines the control logic when the i-th (i∈{0,1,2,...,MaxPwmChlNum-1}, MaxPwmChlNum is the number of PWM output channels) PWM output channel and the j-th (j∈{0,1,2,...,MaxIcuChlNum-1}, MaxIcuChlNum-1 is the number of ICU acquisition channels) ICU acquisition channel are turned on. If the output of the i-th PWM channel is to be collected by the j-th ICU channel, the subsequent MCU only needs to control the corresponding transistor switch according to the control logic stored in the mapping matrix Map(i,j) to realize the connection between the corresponding single PWM channel and the single ICU channel on the physical link. If the same PWM output channel is to be collected by multiple ICU channels, it is only necessary to perform a binary OR operation on the corresponding multiple mapping matrix element values ​​and feed them back to the MCU to pull up or down the corresponding transistor switch ports, thereby realizing the connection between a single PWM output channel and multiple ICU collection channels on the physical link.

[0062] In this embodiment, in the result comparison and fault recovery module, parameters related to the square wave signal in the PWM drive and ICU drive control registers, such as pulse period, duty cycle, frequency, and polarity, are obtained respectively, and the parameters are compared to determine whether they are equal, so as to diagnose whether the pulse wave output is normal.

[0063] Figure 5 FIG. 1 is a flow chart of a pulse width modulation signal diagnosis method according to another exemplary embodiment of the present application. Figure 5 As shown, in an exemplary embodiment, the pulse width modulation signal diagnosis method includes the following steps:

[0064] In step S1, in the clock synchronization module, the MCU clock is divided by the MCAL software, and the reference of the PWM drive and the ICU drive to the MCU clock is configured, so that the PWM drive and the ICU drive reference the same clock, or the frequencies of the clocks referenced by the two modules are kept consistent.

[0065] In step S2, in the channel mapping and connection module, if any PWM output channel is to be collected by any number of ICU channels, the mapping matrix Map of the PWM channel and the ICU channel is queried to obtain the corresponding channel mapping control logic. The MCU controls the corresponding transistor switches through the DIO module based on the obtained channel mapping control logic to achieve flexible and configurable conduction of the corresponding PWM channel and ICU channel.

[0066] In step S3, after starting the PWM self-diagnosis, in the result comparison module and the fault recovery module, the parameters related to the square wave signal in the PWM channel and ICU channel control registers are respectively obtained, such as pulse period, duty cycle, frequency and polarity, etc. By comparing whether the values ​​of the parameters at the PWM output end and the ICU acquisition end are equal, it is determined whether the output of the PWM channel has a fault.

[0067] If a PWM channel output fault is detected, the diagnosis result will be reported to the MCU for processing. The MCU will decide on recovery measures such as multi-channel acquisition re-diagnosis, MCU reset, PWM drive re-initialization, and replacement of the hardware physical channel of the PWM output port based on the actual working conditions.

[0068] This application uses the ICU acquisition function of the MCU itself to realize the diagnosis of the PWM output of the MCU, that is, to realize the pulse width modulation signal diagnosis, which can realize the flexible and configurable mutual mapping of multiple PWM channels and multiple ICU acquisition channels, and simplify the cumbersomeness of the external PWM output and ICU acquisition pin connection steps; through the process of ICU acquisition to diagnose whether the PWM output is normal, the correctness and efficiency of the MCAL software configuration and program software are verified; through the self-diagnosis results of the PWM output, the stability and reliability of the MCU system operation can be improved.

[0069] Figure 6 is a block diagram of a pulse width modulation signal diagnostic device shown in an exemplary embodiment of the present application. The device can be applied to Figure 1 The device may also be applicable to other exemplary implementation environments and specifically configured in other devices, and this embodiment does not limit the implementation environment to which the device is applicable.

[0070] like Figure 6As shown, the exemplary pulse width modulation signal diagnostic device is applied to a vehicle terminal, the vehicle terminal includes a pulse width modulation module and an input capture unit, and the exemplary pulse width modulation signal diagnostic device includes: a synchronization module 610, a connection module 620, an acquisition module 630 and a comparison module 640.

[0071] Among them, the synchronization module 610 is used to synchronize the clock frequencies of the pulse width modulation module and the input capture unit, wherein the pulse width modulation module is used to output the pulse width modulation signal through the pulse signal output channel; the connection module 620 is used to connect the pulse signal output channel of the pulse width modulation module with the input capture channel of the input capture unit; the acquisition module 630 is used to obtain the output signal parameters corresponding to the pulse width modulation signal through the pulse width modulation module, and to acquire the parameters of the pulse width modulation signal input to the input capture unit through the input capture unit to obtain the capture signal parameters; the comparison module 640 is used to compare the output signal parameters with the capture signal parameters to generate a diagnostic result corresponding to the pulse width modulation signal according to the comparison result.

[0072] It should be noted that the pulse width modulation signal diagnosis device provided in the above embodiment and the pulse width modulation signal diagnosis method provided in the above embodiment belong to the same concept, wherein the specific manner in which each module and unit performs the operation has been described in detail in the method embodiment, and will not be repeated here. In practical applications, the pulse width modulation signal diagnosis device provided in the above embodiment can allocate the above functions to different functional modules as needed, that is, divide the internal structure of the device into different functional modules to complete all or part of the functions described above, and this is not limited here.

[0073] An embodiment of the present invention further provides a vehicle terminal, comprising: one or more processors; a storage device for storing one or more programs, when the one or more programs are executed by the one or more processors, the vehicle terminal implements the pulse width modulation signal diagnosis method provided in each of the above embodiments. In this embodiment, the above vehicle terminal can be an electronic device.

[0074] Figure 7 The structure diagram of the computer system of the electronic device suitable for implementing the embodiment of the present invention is shown. It should be noted that: Figure 7 The computer system 700 of the electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.

[0075] like Figure 7As shown, the computer system 700 includes a central processing unit (CPU) 701, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 702 or the program loaded from the storage part 708 to the random access memory (RAM) 703, such as executing the methods provided in the above-mentioned various embodiments. In the RAM 703, various programs and data required for system operation are also stored. The CPU 701, the ROM 702 and the RAM 703 are connected to each other through the bus 704. The input / output (I / O) interface 707 is also connected to the bus 704.

[0076] The following components are connected to the I / O interface 705: an input section 706 including a keyboard, a mouse, etc.; an output section 707 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 708 including a hard disk, etc.; and a communication section 709 including a network interface card such as a LAN (Local Area Network) card, a modem, etc. The communication section 709 performs communication processing via a network such as the Internet. A drive 710 is also connected to the I / O interface 705 as needed. A removable medium 711, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 710 as needed so that a computer program read therefrom is installed into the storage section 708 as needed.

[0077] In particular, according to an embodiment of the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present invention includes a computer program product, which includes a computer program carried on a computer readable medium, and the computer program includes a computer program for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication section 709, and / or installed from a removable medium 711. When the computer program is executed by a central processing unit (CPU) 701, various functions defined in the system of the present invention are executed.

[0078] It should be noted that the computer-readable medium shown in the embodiment of the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable computer program. This propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. A computer program contained on a computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.

[0079] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present invention. Among them, each box in the flowchart or block diagram can represent a module, a program segment, or a part of the code, and the above-mentioned module, program segment, or a part of the code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of boxes in the block diagram or flowchart, can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0080] The units involved in the embodiments of the present invention may be implemented by combining software and hardware, and the units described may also be arranged in a processor. The names of these units do not constitute limitations on the units themselves in certain circumstances.

[0081] Another aspect of the present invention further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor of a computer, causes the computer to execute the pulse width modulation signal diagnosis method provided in the above-mentioned embodiments. The computer-readable storage medium may be included in the electronic device described in the above-mentioned embodiments, or may exist independently without being assembled into the electronic device.

[0082] It should be noted that, although several modules or units of the equipment for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiments of the present application, the features and functions of two or more modules or units described above can be embodied in one module or unit. On the contrary, the features and functions of one module or unit described above can be further divided into being embodied by multiple modules or units.

[0083] Another aspect of the present application also provides a computer program product or a computer program, which includes a computer instruction stored in a computer-readable storage medium. A processor of a computer device reads the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device executes the pulse width modulation signal diagnosis method provided in each of the above embodiments.

[0084] Through the description of the above implementation methods, it is easy for those skilled in the art to understand that the example implementation methods described here can be implemented by software or by combining software with necessary hardware. Therefore, the technical solution according to the implementation methods of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which can be a personal computer, a server, a touch terminal, or a network device, etc.) to execute the method according to the implementation methods of the present application.

[0085] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the embodiments disclosed herein. The present application is intended to cover any variations, uses or adaptations of the present application, which follow the general principles of the present application and include common knowledge or customary technical means in the art that are not disclosed in the present application.

[0086] The above embodiments are merely illustrative of the principles and effects of the present invention, and are not intended to limit the present invention. Anyone familiar with the technology may modify or change the above embodiments without violating the spirit and scope of the present invention. Therefore, all equivalent modifications or changes made by a person of ordinary skill in the art without departing from the spirit and technical ideas disclosed by the present invention shall still be covered by the claims of the present invention.

Claims

1. A pulse width modulation signal diagnosis method, characterized in that: Applied to a vehicle terminal, the vehicle terminal includes a pulse width modulation module and an input capture unit, and the method includes: Synchronizing the clock frequencies of the pulse width modulation module and the input capture unit, wherein the pulse width modulation module is used to output a pulse width modulation signal through a pulse signal output channel; Connecting the pulse signal output channel of the pulse width modulation module to the input capture channel of the input capture unit; The output signal parameters corresponding to the pulse width modulation signal are acquired through the pulse width modulation module, and the pulse width modulation signal input to the input capture unit is collected through the input capture unit to obtain the captured signal parameters; The output signal parameter is compared with the captured signal parameter to generate a diagnosis result corresponding to the pulse width modulation signal according to the comparison result.

2. The pulse width modulation signal diagnosis method according to claim 1, characterized in that: Synchronizing the clock frequencies of the pulse width modulation module and the input capture unit, comprising: Performing clock frequency division on the microcontroller clock to obtain a divided microcontroller clock; The pulse width modulation module and the input capture unit are controlled to reference the divided microcontroller clock, so that the clock frequencies of the pulse width modulation module and the input capture unit are synchronized.

3. The pulse width modulation signal diagnosis method according to claim 1, characterized in that: Connecting the pulse signal output channel of the pulse width modulation module with the input capture channel of the input capture unit includes: According to a preset mapping matrix table, the first switches corresponding to the multiple pulse signal output channels and the second switches corresponding to the multiple input capture channels are controlled respectively to connect the pulse signal output channels of the pulse width modulation module with the input capture channels of the input capture unit, wherein the mapping matrix table includes control logic when the pulse signal output channels and the input capture channels are turned on.

4. The pulse width modulation signal diagnosis method according to claim 3, characterized in that: The method further comprises: If the number of the pulse signal output channels and the number of the input capture channels are both one, controlling the first switch corresponding to the pulse signal output channel and the second switch corresponding to the input capture channel according to the control logic in the mapping matrix table to connect the pulse signal output channel and the input capture channel; If the number of the pulse signal output channels is one and the number of the input capture channels is multiple, a bitwise OR operation is performed on the mapping matrix elements corresponding to the pulse signal output channel and the input capture channel, and a first switch corresponding to the pulse signal output channel and a second switch corresponding to the input capture channel are controlled according to a control logic corresponding to the operation result, so as to connect the pulse signal output channel and the input capture channel; If there are multiple pulse signal output channels, the multiple pulse signal output channels are connected to the input capture channels in sequence by rotating the time slices.

5. The pulse width modulation signal diagnosis method according to claim 4, characterized in that: The method further comprises: Each of the pulse signal output channels and each of the input capture channels are interconnected via a star structure, the bases of the first switch and the second switch are both connected to a micro control unit, and the conduction and cutoff of the first switch and the second switch are controlled by the I / O control of the micro control unit; The I / O channels are multiplexed by the I / O expansion chip to control the plurality of first switches and / or second switches.

6. The pulse width modulation signal diagnosis method according to claim 5, characterized in that: The method further comprises: Writing the value of each bit in the mapping matrix element into the corresponding I / O channel to obtain the corresponding control logic, so as to control the on or off of the first switch corresponding to the pulse signal output channel and the second switch corresponding to the input capture channel according to the control logic, and connect the pulse signal output channel and the input capture channel; If there are multiple input capture channels, the values ​​of each bit in the mapping matrix elements corresponding to the pulse signal output channel and the input capture channel are subjected to a bitwise OR operation to obtain the corresponding control logic.

7. The pulse width modulation signal diagnosis method according to any one of claims 1 to 6, characterized in that: Generating a diagnosis result corresponding to the pulse width modulation signal according to the comparison result, including: If the comparison result is that the output signal parameter and the captured signal parameter are the same, then determining that the diagnosis result corresponding to the pulse width modulation signal is normal; If the comparison result is that the output signal parameter and the captured signal parameter are different, then it is determined that the diagnosis result corresponding to the pulse width modulation signal is abnormal.

8. The pulse width modulation signal diagnosis method according to claim 7, characterized in that: After generating a diagnosis result corresponding to the pulse width modulation signal according to the comparison result, the method further includes: If the diagnosis result corresponding to the pulse width modulation signal is abnormal, obtaining the current working condition; The recovery measures are determined according to the current working condition, and the recovery measures include re-detecting the square wave signal, resetting the micro control unit, initializing the pulse width modulation module, and replacing the pulse signal output channel.

9. A pulse width modulation signal diagnostic device, characterized in that: Applied to a vehicle terminal, the vehicle terminal includes a pulse width modulation module and an input capture unit, and the device includes: A synchronization module, used for synchronizing the clock frequencies of the pulse width modulation module and the input capture unit, wherein the pulse width modulation module is used for outputting a pulse width modulation signal through a pulse signal output channel; A connection module, used to connect the pulse signal output channel of the pulse width modulation module with the input capture channel of the input capture unit; An acquisition module, used for acquiring the output signal parameters corresponding to the pulse width modulation signal through the pulse width modulation module, and acquiring the parameters of the pulse width modulation signal input to the input capture unit through the input capture unit to obtain the captured signal parameters; A comparison module is used to compare the output signal parameter with the capture signal parameter to generate a diagnosis result corresponding to the pulse width modulation signal according to the comparison result.

10. A vehicle terminal, characterized in that: The vehicle terminal comprises: one or more processors; A storage device for storing one or more programs, which, when executed by the one or more processors, enables the vehicle terminal to implement the pulse width modulation signal diagnosis method as described in any one of claims 1 to 8.

Citation Information

Cited By

  • Pulse synchronous capturer based on asynchronous setting end triggering and processor

    CN121749953A

  • Pulse synchronous capturer and processor based on asynchronous set terminal trigger

    CN121749953B