System and method for automatically testing duty ratio adjustment precision of HRPWM (High Resolution Pulse Width Modulation) module
By using automated testing systems and methods, the problem of time-consuming and labor-intensive testing of HRPWM modules on MCU/DSP chips has been solved, achieving efficient and accurate MEP configuration measurement and analysis, and generating detailed reports.
Patent Information
- Application Number
- CN202511897236.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-16
- Publication Date
- 2026-01-16
- Estimated Expiration
- 2045-12-16
AI Technical Summary
In the existing technology, testing high-precision pulse width modulation (HRPWM) modules on MCU/DSP chips is time-consuming and labor-intensive, especially for HRPWM modules with 256 MEP configurations, which require a lot of time and manpower.
An automatic testing method for the duty cycle adjustment accuracy of an HRPWM module was designed. By loading a test scheme and generating test instructions, the method utilizes a host computer, an oscilloscope, and a channel multiplexing selection module to achieve automated testing, including HRPWM initialization, MEP configuration, and multiplexing path selection control. The method combines oscilloscope measurement of waveform data with batch analysis and calculation to automatically mark unqualified points.
It enables efficient batch testing, improves testing efficiency, and achieves measurement accuracy down to the picosecond level. It can quickly complete the measurement and analysis of the full configuration of MEP, mark non-conforming points, and generate detailed test reports.
Smart Images

Figure CN121348050A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of circuit testing, in particular to a HRPWM module duty cycle regulation precision automatic testing system and method. BACKGROUND
[0002] Many MCU / DSP chips have high-precision pulse width modulation (HRPWM) modules, which are realized by using micro-edge positioner (MEP) technology on ordinary PWM modules. In simple terms, a counting period is further divided into many small MEP steps, and the minimum MEP step is 150ps.
[0003] During the chip testing process of a flow sheet, it is necessary to ensure that the PWM output edges corresponding to each configuration of the MEP of the module are adjusted within a normal range. The MEP configuration of HRPWM generally has 256, and it needs to be measured 255 times. A single PWM part chip has realized A / B channel configurable HRPWM, and a single chip generally has 8 PWM modules, and the HRPWM channel may reach 16. If the HRPWM module of the chip is to be tested comprehensively, a considerable amount of time and manpower will be consumed. SUMMARY
[0004] In view of the above technical problems in the related art, the present application provides a HRPWM module duty cycle regulation precision automatic testing method, comprising the following steps:
[0005] S1, load a test scheme, and configure variables of a power supply, a unit under test, and an oscilloscope according to the test scheme;
[0006] S2, generate a test instruction according to the test scheme, wherein the test instruction comprises HRPWM initialization, HRPWM MEP configuration, and multiplexing path selection control;
[0007] S3, test the unit under test according to the test instruction sequence;
[0008] S4, when testing each MEP value, first average the waveforms of the trigger edges to obtain first waveform data, and then set a horizontal delay time according to the waveform frequency and the configured MEP, average the non-trigger edge waveforms to obtain second waveform data;
[0009] S5, calculate the first waveform data and the second waveform data to obtain the micro-shift value between each MEP configuration.
[0010] Specifically, the step S4 further comprises:
[0011] S41, respectively, from the first waveform data MEP(MepValue)_H0, the second waveform data MEP(MepValue)_H1, respectively, obtain the first waveform edge data H0_Edge, the second waveform edge data H1_Edge;
[0012] S42, according to the first waveform edge data H0_Edge, the second waveform edge data H1_Edge, respectively, obtain the set voltage value near waveform data H0_P, H1_P;
[0013] S43, according to the set voltage value near waveform data H0_P, H1_P, obtain the accurate time value H0_Time, H1_Time;
[0014] S44, the difference between H0_Time, H1_Time is taken as the pulse width MEP(MepValue)-PulseWidth of MEP measurement.
[0015] Specifically, step S2 further comprises:
[0016] S21, waiting for host computer instruction;
[0017] S22, instruction decoding;
[0018] S23, instruction format is consistent and instruction exists, if not, execute step S21;
[0019] S24, according to the instruction, initialize HRPWM or HRPWM MEP configuration or multiplex path control.
[0020] Specifically, step S41 is specifically: from the first waveform data MEP(MepValue)_H0, the second waveform data MEP(MepValue)_H1, respectively, take out a piece of data in array form, recorded as Fragment, set error value Error, sum of Fragment and take average recorded as Avg; traverse Fragment, traverse the value taken out recorded as ItemValue, when abs(ItemValue-Avg)>Error, Avg>1.65, its corresponding time point is recorded as edge point TH, Avg<1.65, its corresponding time point is recorded as TL, when TH<TL, mark as falling edge, when TH>TL, mark as rising edge, according to TH, TL, take out data from the whole data to obtain edge data fragment, that is, H0_Eedge, H1_Edge are obtained by this method.
[0021] Specifically, step S42 is specifically: through the set voltage point StandValue, the point number n, the error Error, the set point and its surrounding points 2n in the error range are taken out, that is, the number of data points taken out is 2n+1.
[0022] Specifically, step S43 is specifically:
[0023] The voltage data P[0]_V, P[2n+1]_V and the time data P[0]_T, P[2n+1]_T of the extracted waveforms Hx_P[0], Hx_P[2n+1] are taken out, and the time calculation formula can be obtained by linear interpolation method:
[0024]
[0025] The H0_Time and H1_Time can be obtained through the formula.
[0026] Specifically, step S1 further includes: S0: loading a test configuration file, and configuring a power supply, a unit under test and an oscilloscope according to the test configuration file.
[0027] Specifically, whether the power supply current exceeds a threshold value is monitored in real time, and if yes, an alarm is sent out and a power-off process is performed.
[0028] In a second aspect, another embodiment of the present application discloses an HRPWM module duty cycle regulation precision automatic test system, which comprises: a host computer, a unit under test, a channel multiplexing selection module, a power supply and an oscilloscope; wherein the unit under test comprises a test board and a chip under test; the power supply is connected with the host computer through a USB, the unit under test is connected with the host computer through a serial port, the power supply supplies power for the unit under test and the channel multiplexing selection module, and the oscilloscope is connected with the host computer through a USB; the system is used for executing the HRPWM module duty cycle regulation precision automatic test method according to any one of the above.
[0029] Specifically, the channel multiplexing selection module comprises: 16 relays, and a function of 16-way input to 4-way output is realized by controlling the on-off of the relays through triodes.
[0030] A Python host computer is taken as a main body, instructions are sent from the host computer to the unit under test and the oscilloscope device, the cooperative work of the test system is realized, the configuration of the HRPWM and the multiplexing path selection control are realized by defining the instruction format of the unit under test, the initialization configuration of the oscilloscope is realized through an automatic configuration program, a plurality of waveforms are tested and waveform data is saved through the oscilloscope, the step measurement of the HRPWM between different configurations is realized through batch analysis and calculation of the waveform data, the MEP test results are analyzed through calculation and processing, points exceeding the performance range are marked out, and finally the data is exported in batches after simplification, and a table and a test analysis report are obtained. According to the scheme, a host computer is finally realized to lead the MEP automatic measurement and batch analysis test system of the multi-channel HRPWM module of a single chip.
[0031] The present application has the following advantages:
[0032] Batch testing greatly improves the test efficiency and can quickly realize the full configuration measurement of MEP.
[0033] Data batch processing and analysis report export realize the accuracy analysis and calculation of the full configuration MEP, mark the unqualified points, and make an explanation in the report.
[0034] High measurement accuracy, according to the oscilloscope configuration, the measurement accuracy can reach ps level. BRIEF DESCRIPTION OF DRAWINGS
[0035] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings needed to be used in the embodiments will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.
[0036] Figure 1 is a schematic diagram of a HRPWM module duty cycle regulation accuracy automatic test system provided by the embodiment of the present application;
[0037] Figure 2 is a schematic diagram of one of the HRPWM module duty cycle regulation accuracy automatic test methods provided by the embodiment of the present application;
[0038] Figure 3 is a schematic diagram of a unit under test configuration provided by the embodiment of the present application;
[0039] Figure 4 is a schematic diagram of a waveform edge micro-shift calculation provided by the embodiment of the present application;
[0040] Figure 5 is a schematic diagram of another HRPWM module duty cycle regulation accuracy automatic test method provided by the embodiment of the present application. DETAILED DESCRIPTION
[0041] The technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only some embodiments of the present application, not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art belong to the scope of protection of the present application.
[0042] Embodiment one
[0043] Reference Figure 1The embodiment provides a kind of HRPWM module duty cycle regulation precision automatic test system, it includes: host computer, measured unit, channel multiplexing selection module, power supply, oscilloscope;Wherein, measured unit includes test board and measured chip;The power supply is connected with host computer by USB, the measured unit is connected with host computer by serial port, the power supply is powered for measured unit, channel multiplexing selection module, the oscilloscope is connected with host computer by USB;
[0044] Host computer controls the whole test process, controls oscilloscope and power supply by Visa driver+PyVisa, and controls measured unit by defining instruction format.Host computer is responsible for outputting voltage configuration to power supply, measurement configuration to oscilloscope, measured HRPWM output related configuration (such as waveform frequency, multiplexing path, etc.) to measured unit, and reading and classifying saving oscilloscope measurement data.
[0045] Measured unit decodes host computer instruction according to instruction format, then completes related module configuration, and can receive host computer instruction to control channel multiplexing selection module (external control line is needed).Measured unit includes test board and measured chip, test board leads out corresponding output channel of HRPWM module, multiplexing selection module control line, and is connected to channel multiplexing selection module by wire / Dupont wire.
[0046] Channel multiplexing selection module is composed of 16 relays, and 16-way input is converted to 4-way output by controlling the on-off of relay through triode, and triode is controlled by 1 3-8 decoder tube.The normally open end of relay is connected to signal input port, and the normally closed end is internal connection signal, and every 4 internal connection signals are connected to 1 output end as a group of signals, and there are 4 groups of output ends.Specifically, input channel 1 / 5 / 9 / 13 is combined to output 1, input channel 2 / 6 / 10 / 14 is combined to output 2, input channel 3 / 7 / 11 / 15 is combined to output 3, and input channel 4 / 8 / 12 / 16 is combined to output 4.Through the control of 3-8 decoder, when the control signal input of 3-8 decoder is 000b, input channel 1 / 2 / 3 / 4 is turned on to output channel 1 / 2 / 3 / 4 respectively;When the control signal input is 001b, input channel 5 / 6 / 7 / 8 is turned on to output channel 1 / 2 / 3 / 4 respectively;When the control signal input is 010b, input channel 9 / 10 / 11 / 12 is turned on to output channel 1 / 2 / 3 / 4 respectively;When the control signal input is 011b, input channel 13 / 14 / 15 / 16 is turned on to output channel 1 / 2 / 3 / 4 respectively.During operation, only one relay exists in each output channel to form a path to output, realizing 16-way signal input to 4-way signal.
[0047] Reference Figure 2 , Figure 5The embodiment discloses a kind of HRPWM module duty cycle regulation precision automatic test method, comprising the following steps:
[0048] S1, load test scheme, according to the variable configuration of power supply, unit to be measured, oscilloscope according to the test scheme;
[0049] The test scheme of the embodiment includes the configuration variable of power supply, unit to be measured, oscilloscope.For example: power voltage, limited current.
[0050] Specifically, before executing step S1, it further includes: S0: load test configuration file, according to test configuration file, configure power supply, unit to be measured, oscilloscope.
[0051] The host computer of the embodiment obtains configuration file, and the host computer is configured according to the selected test scheme unit to be measured, oscilloscope, power supply.
[0052] The embodiment first initializes unit to be measured, oscilloscope, power supply, and those skilled in the art can understand that initialization means power-on, oscilloscope power-on, measured power supply power-on and the like.
[0053] Then, according to the test scheme, unit to be measured, oscilloscope, power supply are configured.The specific test scheme contains the configuration variable of unit to be measured, oscilloscope, power supply.
[0054] Specifically, the host computer of the embodiment runs test automation program, and the test automation program uses Python programming.Those skilled in the art know that it can use other programming languages, as long as it can realize the automatic test program of the embodiment.
[0055] Steps S2-S5 of the embodiment are to test the HRPWM of unit to be measured, which is a complete test sub-process.
[0056] S2, according to the test scheme, generate test instructions, the test instructions include: HRPWM initialization, HRPWM MEP configuration, multiplexing path selection control;
[0057] The embodiment first selects HRPWM channel according to test scheme, and the chip of unit to be measured in the embodiment has 16 HRPWM channels.After selecting the HRPWM channel to be tested, the embodiment also needs to configure the MEP value of HRPWM.The HRPWM channel of the embodiment has 256 MEP values.
[0058] Specifically, the test scheme of the embodiment can record the HRPWM channel to be tested and its corresponding MEP value.
[0059] The HRPWM channel in a test scheme and the corresponding MEP value configuration are as follows:
[0060] HRPWM channel, MEP configuration value
[0061] In the automatic test, the HRPWM channel can be sequentially read, the HRPWM channel corresponding to the current test can be determined according to the HRPWM channel, and the corresponding test instruction can be generated according to the corresponding MEP configuration. The specific test instruction includes HRPWM initialization, HRPWM MEP configuration, and multiplexing path selection control.
[0062] The multiplexing channel selection control of the embodiment generally corresponds to the HRPWM channel number. For example, when the HRPWM channel number is 1, the multiplexing channel is generally also 1; when the HRPWM channel number is 2, the multiplexing channel is generally also 2; and so on; when the HRPWM channel number is 16, the multiplexing channel is generally also 16.
[0063] The specific test instruction can be:
[0064] Test instruction 1: channel 1, MEP value, multiplexing channel 1 .....
[0066] Test instruction 256: channel 2, MEP value, multiplexing channel 2 ....
[0068] Test instruction 4080: channel 16, MEP value, multiplexing channel 16
[0069] The control instruction format of the unit under test is shown in Table 1.
[0070] Table 1: Control instruction format
[0071] Among them, field 1 is used for control category identification, and field 2 and subsequent fields are used for parameter input. HRPWM-INIT is set as the HRPWM initialization instruction, HRPWM-MEP is set as the MEP configuration instruction of HRPWM, CHANNEL-SEL is set as the multiplexing module control instruction, and the number of instruction format fields can be flexibly changed according to the amount of parameters to be transmitted.
[0072] Specifically, the host computer of the embodiment sends a configuration instruction, first sends a module selection and multiplexing control instruction, waits for the configuration of the chip under test to be completed, and then sends a start test instruction. The chip under test enters MEP value configuration, and the host computer can perform cyclic configuration (0~255) or selected configuration (0~255 selected data array) of the MEP value according to the test configuration file. The same module selection and multiplexing control related values are also obtained through the configuration file.
[0073] 1) The measured chip decodes the host computer control instruction after receiving it, which will have 4 groups of fields: control instruction, HRPWM module and output selection, multiplexing channel selection, MEP value configuration;
[0074] 2) The control instruction includes: start test instruction, test configuration instruction, end test instruction;
[0075] 3) When the control instruction is the start test instruction, the measured chip performs module initialization, port configuration and other related operations, and enters the test configuration receiving state;
[0076] 4) When the control instruction is the end test instruction, the measured chip closes the module and waits for a new start instruction.
[0077] 5) When the control instruction is the test configuration instruction (which needs to be after a start test instruction), the measured chip splits the received HRPWM module and output value into modules and corresponding channels, then performs module and GPIO configuration, uses the received multiplexing channel selection value to control the corresponding GPIO of the multiplexing module to realize external multiplexing channel selection, and directly uses the received MEP value to configure the register;
[0078] 6) In actual application, module, channel selection, multiplexing control and MEP value configuration are divided into two instructions. Module and channel selection are configured before the start test instruction, and only MEP value can be configured after the start test instruction. After each configuration, the measured chip returns data to the host computer to determine whether the configuration is complete.
[0079] Specifically, the host computer of the present embodiment iterates the test scheme and generates a test instruction according to the test scheme. Specifically, the host computer can determine whether the test scheme is executed after the oscilloscope completes the measurement. If not, repeat step S2.
[0080] S3, test the measured unit according to the test instruction sequence;
[0081] S4, when testing each MEP value, first take the average of the trigger edge waveform to obtain first waveform data, then set the horizontal delay time according to the waveform frequency and the configured MEP to take the average of the non-trigger edge waveform to obtain second waveform data;
[0082] The step S4 of the embodiment is a test sub-process, in the test sub-process, first, the waveform of the trigger edge is averaged and saved to obtain first waveform data, the first waveform data file takes MEP (MepValue)_H0 as a suffix, then the horizontal delay time is set according to the waveform frequency and the configured MEP, and the second waveform data is saved after the waveform is averaged, the second waveform data file name takes MEP (MepValue)_H1 as a suffix, and the file name also contains the test scheme, the test sample number and the test configuration for classification and saving.
[0083] S5, calculating the first waveform data and the second waveform data to obtain the micro-shift value between each MEP configuration.
[0084] The oscilloscope of the embodiment is a Tek 4 / 5 / 6 series oscilloscope, the oscilloscope measurement configuration is an average value mode, and the number of times of averaging is configured to be 500 / 1000 / 2000, the higher the number of times of averaging, the more stable the measured waveform, and the higher the measurement accuracy. Each time the MEP configuration of HRPWM is modified, the waveform data is saved after the number of times of averaging of the oscilloscope reaches the set value, and the waveform data includes time and oscilloscope channel measurement data, which correspond to the time and channel data.
[0085] In the measurement process, the rising edge trigger can be used, when the MEP configuration of HRPWM changes, the falling edge of the measured waveform will move forward or backward. Since the range of movement is about 150ps / 1 MEP, the waveform jitter measured by the oscilloscope is much larger than 150ps, and the waveform jitter can be filtered out by averaging the waveform, so that the waveform is stabilized. The waveform is averaged, and the oscilloscope scale is set to the minimum (such as 200ps), and the measurement accuracy can reach 4ps.
[0086] The application can realize the selection of multiple HRPWM output channels through the multiplexing channel, and the multiplexing channel can be directly controlled by the measured unit or other control chips; the measurement axis searching and moving method of the oscilloscope can realize the fast movement of the measurement axis to the required position in the measurement process of the oscilloscope, so that the step test is realized.
[0087] Further, the embodiment measures by averaging the micro-shift between two step configurations, the waveform edge point is taken as a reference after the waveform tends to be stable in the previous configuration, the time when the waveform tends to be stable is 10s, then the CMPAHR is configured, the CMPAHR can add 1 to the previous configuration or any number within the range, after the second configuration is completed, the waveform still needs to be stable, then the same horizontal point as the point taken in the previous configuration is taken at the edge, and the time between the two points is obtained. The application realizes the ps-level measurement by averaging the waveform and using the multi-point linear interpolation method.
[0088] Reference Figure 4 , Specifically, the step S4 further comprises:
[0089] S41, respectively, from the first waveform data MEP(MepValue)_H0, the second waveform data MEP(MepValue)_H1 respectively obtain the first waveform edge data H0_Edge, the second waveform edge data H1_Edge;
[0090] Specifically, the cutting waveform edge data adopts "multi-point judgment method", and a section of data is taken out in array form, which is recorded as Fragment, an error value Error is set, and the sum of Fragment is taken to average and recorded as Avg. Traverse Fragment, and the value taken out is recorded as ItemValue. When abs(ItemValue-Avg)>Error, Avg>1.65, the corresponding time point is recorded as edge point TH, and when Avg<1.65, the corresponding time point is recorded as TL. When TH<TL, it is marked as falling edge, and when TH>TL, it is marked as rising edge. According to TH, TL, the data is taken out from the whole data to obtain the edge data fragment, that is, H0_Eedge and H1_Edge are obtained by this method.
[0091] S42, according to the first waveform edge data H0_Edge, the second waveform edge data H1_Edge respectively obtains the waveform data H0_P, H1_P near the set voltage value;
[0092] The waveform data near the set voltage value is obtained. First, the set voltage point StandValue, the point number n and the error Error are taken out, and the set point and its surrounding points 2n in the error range are taken out, that is, the number of data points taken out is 2n+1. The specific method is to traverse Hx_Edge (x takes value 0 / 1), and the value taken out is ItemValue. When abs(ItemValue-StandValue)<Error, the point is taken out, and the data n before and after the point is taken out, that is, the waveform data near the set point voltage can be obtained, that is, H0_P and H1_P are obtained by this method.
[0093] S43, according to the waveform data H0_P, H1_P near the set voltage value, the accurate time value H0_Time, H1_Time is obtained;
[0094] The accurate time point is obtained by "n-point linear interpolation method". The smaller n is, the more accurate the result is. The voltage data P[0]_V, P[2n+1]_V and time data P[0]_T, P[2n+1]_T of waveform Hx_P[0], Hx_P[2n+1] are taken out, and the linear interpolation method can obtain the time calculation formula:
[0095]
[0096] H0_Time and H1_Time can be obtained by the formula.
[0097] S44, the difference between H0_Time and H1_Time is taken as the pulse width MEP(MepValue)_PulseWidth of MEP measurement.
[0098] MEP(MepValue)_PulseWidth is the micro-shift value. In this embodiment, the pulse width between two adjacent MepValue is calculated as the micro-shift value of the adjacent MEP configuration, for example, MEP(1)_PulseWidth - MEP(0)_PulseWidtg is the micro-shift value of MEP configuration 0 and 1.
[0099] Step S4 is to calculate the waveform edge micro-shift. The processed data is subjected to difference processing to obtain the micro-edge shift time. Finally, the data that does not meet the standard is marked and exported to a table document.
[0100] The waveform data H0, H1, H0_Edge, H1_Edge, H0_P, and H1_P all contain waveform voltage data and corresponding time data.
[0101] Specifically, the embodiment further includes: after the waveform data processing is completed, the adjacent MEP(MepValue)-PulseWidth is subtracted, and when the difference is greater than 300ps, it is marked as an error.
[0102] Reference Figure 3 Specifically, the step S2 of the embodiment includes:
[0103] S21, waiting for the host computer instruction;
[0104] S22, instruction decoding;
[0105] S23, if the instruction format is correct and the instruction exists, step S21 is executed; otherwise, step S21 is executed.
[0106] S24, initializing HRPWM or HRPWM MEP configuration or multiplexing path control according to the instruction.
[0107] Step S2 is the control of the measured unit and the multiplexing module, and the corresponding operation is performed by decoding the host computer instruction.
[0108] The step S2 of the embodiment judges whether the power supply is powered off in execution, and ends the flow when the power supply is powered off. Other steps of the embodiment are all judged whether the power supply is powered off in execution, and an alarm is issued and the flow is ended if powered off.
[0109] The instruction is obtained from the host computer and decoded, if the instruction does not conform to the format, the host computer instruction is re-waited, if the instruction conforms to the format, it is judged whether the instruction exists, and if not, the host computer instruction is re-waited;
[0110] If the instruction conforms to the format and exists, category judgment is performed, and there are three categories: HRPWM initialization, HRPWM MEP configuration, and multiplexing path selection control.
[0111] Specifically, during the test process, real-time monitoring of whether the power supply current exceeds the threshold value is also included, and an alarm is issued and power-off processing is performed if so.
[0112] The application takes the Python host computer as the main body, sends instructions to the measured unit and oscilloscope device through the host computer, realizes the cooperative work of the test system, realizes the configuration of HRPWM, multiplexing path selection control through defining the instruction format of the measured unit, realizes the initialization configuration of the oscilloscope through the automatic configuration program, realizes the step measurement of HRPWM between different configurations through the test and saving of waveform data of multiple waveforms by the oscilloscope, and realizes the analysis of MEP test results through calculation processing, marks the points exceeding the performance range, and finally exports the data after simplification and the test analysis report. According to the scheme, a host computer is finally realized to lead the MEP automatic measurement and batch analysis test system of the multi-channel HRPWM module of a single chip.
[0113] The application has the following advantages:
[0114] Batch testing greatly improves the test efficiency and can quickly realize the MEP full configuration measurement.
[0115] Data batch processing and analysis report export realize the precision analysis and calculation of the full configuration MEP, mark the unqualified points, and explain in the report.
[0116] The measurement precision is high, and the measurement precision can reach the ps level according to the configuration of the oscilloscope.
[0117] The above only describes the preferred embodiment of the application and does not limit the application, and any modification, equivalent replacement, improvement, etc. made within the spirit and principles of the application shall be included in the protection scope of the application.
Claims
1. A method for automatically testing the duty cycle regulation accuracy of an HRPWM module, characterized in that: The method comprises the following steps: S1, loading a test scheme, and configuring variables of a power supply, a unit under test and an oscilloscope according to the test scheme; S2, generating a test instruction according to the test scheme, wherein the test instruction comprises HRPWM initialization, HRPWM MEP configuration and multiplexing path selection control; S3, testing the unit under test according to the test instruction sequence; S4, when testing each MEP value, first obtaining first waveform data by averaging a waveform of a trigger edge, and then obtaining second waveform data by averaging a waveform of a non-trigger edge according to a waveform frequency and a set horizontal delay time of the MEP; S5, calculating the first waveform data and the second waveform data to obtain a micro-shift value between each MEP configuration.
2. The method of claim 1, wherein: The step S4 further comprises: S41, obtaining first waveform edge data H0_Edge and second waveform edge data H1_Edge from first waveform data MEP(MepValue)_H0 and second waveform data MEP(MepValue)_H1 respectively; S42, obtaining set voltage value near waveform data H0_P and H1_P according to the first waveform edge data H0_Edge and the second waveform edge data H1_Edge respectively; S43, obtaining accurate time values H0_Time and H1_Time according to the set voltage value near waveform data H0_P and H1_P; S44, taking a difference between the H0_Time and the H1_Time as a pulse width MEP(MepValue)-PulseWidth of MEP measurement.
3. The method of claim 1, wherein: The step S2 further comprises: S21, waiting for an instruction from a host computer; S22, instruction decoding; S23, if the instruction format is correct and the instruction exists, executing the step S21, otherwise, executing the step S21; S24, initializing HRPWM or configuring HRPWM MEP or controlling multiplexing paths according to the instruction.
4. The method of claim 2, wherein: The step S41 specifically comprises: taking a segment of data from the first waveform data MEP(MepValue)_H0 and the second waveform data MEP(MepValue)_H1 in an array form, denoted as Fragment, setting an error value Error, summing and averaging Fragment, denoted as Avg, traversing Fragment, taking a value during traversal as ItemValue, when abs(ItemValue-Avg)>Error and Avg>1.65, recording a time point corresponding to the value as an edge point TH, when Avg<1.65, recording a time point corresponding to the value as TL, when TH<TL, marking as a falling edge, when TH>TL, marking as a rising edge, and obtaining edge data fragments from the overall data according to TH and TL, that is, obtaining H0_Eedge and H1_Edge by this method.
5. The method of claim 2, wherein The step S42 further comprises: taking a set point and surrounding points 2n within an error range by a set voltage point StandValue, a point number n and an error Error, that is, taking data points 2n+1.
6. The method of claim 2, wherein, The step S43 specifically comprises: The voltage data P[0]_V, P[2n+1]_V and the time data P[0]_T, P[2n+1]_T of the extracted waveforms Hx_P[0], Hx_P[2n+1] are taken out, and a time calculation formula can be obtained by using a linear interpolation method: ; H0_Time and H1_Time can be obtained through the formula.
7. The method of claim 1, wherein: Before step S1, the method further comprises: S0: loading a test configuration file, and configuring a power supply, a unit under test and an oscilloscope according to the test configuration file.
8. The method of claim 1, wherein: Whether the current of the power supply exceeds a threshold value is monitored in real time, and an alarm is sent and power-off processing is performed if the current exceeds the threshold value.
9. An automatic test system for HRPWM module duty cycle regulation accuracy, characterized in that, The system comprises: The system comprises a host computer, a unit under test, a channel multiplexing selection module, a power supply and an oscilloscope, wherein the unit under test comprises a test board and a chip under test; the power supply is connected with the host computer through a USB; the unit under test is connected with the host computer through a serial port; the power supply supplies power for the unit under test and the channel multiplexing selection module; the oscilloscope is connected with the host computer through a USB; and the system is used for executing the HRPWM module duty cycle regulation precision automatic test method according to any one of claims 1-8.
10. The system of claim 9, wherein: The channel multiplexing selection module comprises 16 relays, and a function of converting 16 inputs into 4 outputs is realized by controlling the on-off of the relays through triodes.
Citation Information
Patent Citations
Automatic test platform of high-speed ADC chip and software framework design method thereof
CN107390109A
Automatic test method and device of digital chip PWM module, digital chip and system
CN114859217A
Self-calibration high-resolution PWM signal generation circuit
CN120049867A
Method and systems for high-precision pulse-width modulation
US20140062551A1