CN112526973A - Method for testing differential nonlinearity and integral nonlinearity of analog-to-digital converter of microcontroller - Google Patents

Method for testing differential nonlinearity and integral nonlinearity of analog-to-digital converter of microcontroller Download PDF

Info

Publication number
CN112526973A
CN112526973A CN202011386942.XA CN202011386942A CN112526973A CN 112526973 A CN112526973 A CN 112526973A CN 202011386942 A CN202011386942 A CN 202011386942A CN 112526973 A CN112526973 A CN 112526973A
Authority
CN
China
Prior art keywords
data
microcontroller
nonlinearity
analog
serial port
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202011386942.XA
Other languages
Chinese (zh)
Inventor
肖晗
周玉洁
孙坚
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shanghai Aisinochip Electronic Technology Co ltd
Original Assignee
Shanghai Aisinochip Electronic Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shanghai Aisinochip Electronic Technology Co ltd filed Critical Shanghai Aisinochip Electronic Technology Co ltd
Priority to CN202011386942.XA priority Critical patent/CN112526973A/en
Publication of CN112526973A publication Critical patent/CN112526973A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G05CONTROLLING; REGULATING
    • G05BCONTROL OR REGULATING SYSTEMS IN GENERAL; FUNCTIONAL ELEMENTS OF SUCH SYSTEMS; MONITORING OR TESTING ARRANGEMENTS FOR SUCH SYSTEMS OR ELEMENTS
    • G05B23/00Testing or monitoring of control systems or parts thereof
    • G05B23/02Electric testing or monitoring
    • HELECTRICITY
    • H03ELECTRONIC CIRCUITRY
    • H03MCODING; DECODING; CODE CONVERSION IN GENERAL
    • H03M1/00Analogue/digital conversion; Digital/analogue conversion
    • H03M1/10Calibration or testing
    • H03M1/1071Measuring or testing

Abstract

The invention provides a method for testing differential nonlinearity and integral nonlinearity of an analog-digital converter of a microcontroller, which comprises the following steps: s1: the signal generator generates a sine wave with a preset frequency as a test signal; s2: the microcontroller samples the test signal by adopting an analog-to-digital conversion sampling frequency with a preset rate; s3: the microcontroller adopts a serial port to send sampling data; s4: the computer end receives the sampling data and stores the sampling data into a file; s5: and analyzing the data of the file by the computer by adopting a code density histogram method to obtain a test result. The invention can complete the performance test of important parameters differential nonlinearity and integral nonlinearity of the built-in analog-digital converter in a low-cost and convenient mode under the condition that the microcontroller only has a low-speed input/output interface.

Description

Method for testing differential nonlinearity and integral nonlinearity of analog-to-digital converter of microcontroller
Technical Field
The invention relates to the field of integrated circuits, in particular to a method for testing differential nonlinearity and integral nonlinearity of an analog-to-digital converter of a microcontroller.
Background
An analog-to-digital converter is arranged in a microcontroller, and the analog-to-digital converter is designed in the microcontroller in order to improve the integration level and the product competitiveness of the existing microcontroller, so that the application field of the microcontroller is expanded, the integration degree of the product is improved, the cost is reduced, and the reliability and the product competitiveness are improved.
In the prior art, when a dynamic test method is used for performing performance tests of differential nonlinearity and integral nonlinearity on a built-in analog-to-digital converter of a microcontroller, a large amount of continuous sampling data needs to be stored at a computer end, and a code density histogram method is adopted to analyze the sampling data to obtain a test result. Because the analog-digital sampling frequency is too high, the acquired data volume is large, the continuity of the sampled data needs to be ensured, and the internal high-speed memory cannot store enough data and is difficult to continuously send the data to a computer through a low-speed external interface. Expensive data acquisition equipment is also employed to interface the microcontroller and computer when the microcontroller has a high speed external interface. When the microcontroller has no high-speed external interface, the storage and forwarding of a large amount of continuous high-speed sampling data are difficult to store, the test can not be basically completed, and only the simulation result is taken as a performance index.
Disclosure of Invention
The invention aims to provide a method for testing differential nonlinearity and integral nonlinearity of an analog-digital converter of a microcontroller, which aims to solve the problems that the performance of the differential nonlinearity and the integral nonlinearity of a built-in analog-digital converter cannot be tested when the microcontroller has no high-speed external interface, and expensive instruments are required to be adopted to plug the microcontroller and a computer when the microcontroller has the high-speed external interface.
In order to achieve the above object, the present invention provides a method for testing differential nonlinearity and integral nonlinearity of an analog-to-digital converter of a microcontroller, comprising the following steps:
s1: the signal generator generates a sine wave with a preset frequency as a test signal;
s2: the microcontroller samples the test signal by adopting an analog-to-digital conversion sampling frequency with a preset rate;
s3: the microcontroller adopts a serial port to send sampling data;
s4: the computer end receives the sampling data and stores the sampling data into a file;
s5: and analyzing the data of the file by the computer by adopting a code density histogram method to obtain a test result.
Preferably, step S3 includes: the microcontroller carries data in a double DMA mode and then sends the data through a serial port.
Preferably, the process of the microcontroller completing data transfer by using a dual DMA mode includes the following steps:
s31: firstly, a first DMA is responsible for carrying sampled data and storing the data into a memory cache;
s32: after the first DMA finishes the data transportation of the preset quantity, a second DMA starts to transport the data in the memory cache to a serial port sending register;
s33: and after the second DMA finishes the data transfer of the serial port sending register, returning to the step S31 to enter the next round of data transfer of the first DMA.
Preferably, the step S1 is preceded by: firstly, determining the working rate of the serial port, including:
determining the maximum working rate supported by the serial port of the current microcontroller;
and determining the working rate of the serial port to be any value smaller than the preset range of the maximum working rate.
Preferably, after determining the working rate of the serial port, the method further includes:
determining the sampling frequency of the analog-to-digital conversion at the preset rate as follows: the working speed determined by the serial port of the current microcontroller is any value between 0.5 and 1.0 times.
Preferably, after determining the sampling frequency of the analog-to-digital conversion at the preset rate, the method further includes:
determining the preset frequency of the sine wave as follows: less than 1/10 of the analog-to-digital conversion sampling frequency.
Preferably, in step S4, the computer-side program receives the sample data by using a large cache serial port.
Preferably, in step S5, the computer uses a script program to analyze the data of the file by a code density histogram method to obtain performance parameter test results of differential nonlinearity and integral nonlinearity.
The invention also provides a computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, is adapted to control the implementation of the above-mentioned method.
The method for testing the performance of the differential nonlinearity and the integral nonlinearity of the built-in analog-to-digital converter of the microcontroller can complete the performance test of the differential nonlinearity and the integral nonlinearity of important parameters of the built-in analog-to-digital converter in a low-cost and convenient mode under the condition that the microcontroller only has a low-speed input and output interface.
The invention can reduce the sampling rate of the analog-digital converter on the premise of meeting the serial port communication speed by using the low-frequency sinusoidal signal as the test signal, send the conversion data to the computer end for storage in a low-speed mode, ensure the continuity and the integrity of the data and meet the performance analysis of differential nonlinearity and integral nonlinearity.
Drawings
FIG. 1 is a general flow chart of a differential nonlinearity and integral nonlinearity test method for an analog-to-digital converter of a microcontroller according to a preferred embodiment of the present invention;
FIG. 2 is a schematic diagram of the flow of analog-to-digital conversion data handling within the microcontroller in a preferred embodiment of the invention;
FIG. 3 is a flow chart illustrating DMA carry logic determination of the internal analog-to-digital conversion data of the microcontroller according to the preferred embodiment of the present invention;
FIG. 4 is a schematic flow chart of the preferred embodiment of the present invention for determining the rate of serial ports internal to the microcontroller, the analog to digital conversion frequency, and the frequency of the sine waves generated by the signal generator;
FIG. 5 is a flow chart illustrating the performance parameter results of differential nonlinearity and integral nonlinearity obtained by analyzing data files by a code density histogram method by a script program at a computer end in a preferred embodiment of the present invention.
Detailed Description
While the embodiments of the present invention will be described and illustrated in detail with reference to the accompanying drawings, it is to be understood that the invention is not limited to the specific embodiments disclosed, but is intended to cover various modifications, equivalents, and alternatives falling within the scope of the invention as defined by the appended claims.
For the convenience of understanding the embodiments of the present invention, the following description will be further explained by taking specific embodiments as examples with reference to the drawings, and the embodiments are not to be construed as limiting the embodiments of the present invention.
As shown in fig. 1, the present embodiment provides a method for testing differential nonlinearity and integral nonlinearity of an analog-to-digital converter of a microcontroller, which includes the following steps:
s11: the signal generator generates a sine wave signal;
the signal generator is used for generating a signal to be tested, the signal must be a sine wave, and the signal generator generates a preset sine wave with a low frequency and is used as a test signal. The amplitude of the sine wave signal needs to be slightly larger than the input amplitude range of the microcontroller built-in analog-to-digital converter to be tested to produce a slightly truncated input amplitude.
S12: analog-to-digital conversion and data transmission of the microcontroller;
the step is finished in a microcontroller, and the microcontroller adopts an analog-to-digital conversion sampling frequency with a preset speed rate to carry out digital sampling on the sine wave test signal so as to finish the analog-to-digital conversion of the test signal; after sampling, the microcontroller caches the sampled data and sends the sampled data through the serial port;
s13: receiving and storing data by computer
The program control of the computer end receives the sampling data from the serial port of the microcontroller, writes the sampling data into a file and stores the file in a magnetic disk of the computer;
s14: analyzing data by a computer code density histogram method;
and analyzing the sampled data in the file in the disk by the computer by adopting a code density histogram method to obtain the test results of the performance parameters of differential nonlinearity and integral nonlinearity of the analog-to-digital converter.
In this embodiment, the microcontroller digitally samples the sine wave test signal using an analog-to-digital conversion sampling frequency at a preset rate, and then stores the sampled data in an analog-to-digital converter register.
The step S3 further includes: the microcontroller carries out data handling (caching) in a double DMA mode and then sends data through a serial port. The DMA referred to in the present invention refers to direct memory access.
In a preferred embodiment, as shown in fig. 2, the data flow of the microcontroller in the present invention using the dual DMA method to perform data transfer is as follows:
201: an analog-to-digital converter register;
DMA 1: a DMA controller 1;
202: caching data;
DMA 2: a DMA controller 2;
203: and a serial port sending register.
The above is the generation and flow direction position of the analog-to-digital conversion data in the microcontroller. The data generated by the analog-to-digital conversion is stored in the 201 register, the DMA1 is responsible for transporting the data in the 201 register to the 202 data cache, and the DMA2 is responsible for transporting the data in the 202 data cache to the 203 serial port sending register, so that the data sending process from the microcontroller to the computer is completed.
Referring further to fig. 3, the flow of the DMA transfer logic determination of the internal adc data of the microcontroller according to the embodiment is as follows:
s301: the DMA1 is responsible for carrying the sampled data in the analog-to-digital converter register and storing the data into a memory cache (namely a data cache);
s302: judging whether the carrying quantity of the DMA1 reaches a preset N value;
when the DMA1 completes the predetermined amount of data transfer, the next step is performed.
S303: the DMA2 starts to carry the data in the cache to the serial port sending register;
s304: judging whether the DMA2 completes the data transportation of the serial port sending register or not;
if not, continuing to execute S303; if so, the process returns to step S201 to perform the next round of data transfer of the DMA 1.
In summary, the flow of the judgment of the DMA transfer logic of the internal analog-to-digital conversion data of the microcontroller in the preferred embodiment is described. Firstly, step 301 is that the DMA1 starts to transfer data in the adc register to the data buffer, when the amount of transferred data reaches N (step 302, where the N is generally more than half of the data buffer length and less than the data buffer length), step 303 starts the DMA2 to start transferring data in the data buffer to the serial port transmission register, the total length of the DMA2 transfer is the total length of the data buffer, step 304 waits for the completion of the DMA2 transfer, and then the process loops to step 301 until the computer receiving end saves the file and obtains the converted data with sufficient length.
In still another preferred embodiment, referring to fig. 4, the step S1 further includes the following steps before:
s401: and determining the working rate of the serial port of the microcontroller.
Firstly, determining the maximum working rate supported by the serial port of the current microcontroller;
and then, determining the working rate of the current serial port to be any value smaller than the preset range of the maximum working rate. In this embodiment, the determined serial port operating speed should be slightly lower than the maximum speed of the serial port design to ensure the operating stability.
Referring again to fig. 4, the present embodiment further includes the following steps:
s402: an analog-to-digital conversion sampling frequency of the microcontroller is determined.
In this embodiment, the analog-to-digital conversion sampling frequency of the microcontroller is set to any value between 0.5 and 1.0 times of the working rate determined by the serial port of the current microcontroller. So as to ensure that the data of the analog-digital conversion is not lost when the serial port data is sent. The analog-to-digital converter is carried out according to a fixed conversion rate, the data sending rate of the serial port is higher than the analog-to-digital conversion speed, and otherwise, the analog-to-digital conversion data overflow and loss can be caused. Because the data cache is designed into one area, the sampling rate of the analog-to-digital conversion is not less than half of the rate of the serial port, so that the condition of data fetching and rear-end collision of the serial port is avoided.
Referring again to fig. 4, the present embodiment further includes the following steps:
s403: the frequency of the signal generator sine wave is determined.
In this embodiment, the frequency of the sine wave is set as: less than 1/10, the above-mentioned analog-to-digital conversion sampling frequency. The test signal of this frequency can ensure the sampling accuracy of the analog-to-digital conversion. The sampling point of a single sine wave period reaches more than 10 points, and the sampling precision can be ensured.
In summary, before step S1 is executed, the internal serial port rate of the microcontroller, the analog-to-digital conversion frequency, and the frequency of the sine wave generated by the signal generator can be determined through the above steps S401 to S403.
In a further preferred embodiment, in step S4, the computer receives the sampled data from the microcontroller through the application program control by using a large cache serial port, and stores the sampled data as a data file.
In a further preferred embodiment, in step S5, the computer uses a script program to analyze the data of the file by using a code density histogram method to obtain performance parameter test results of differential nonlinearity and integral nonlinearity. Referring to fig. 5, step S5 specifically includes the following steps:
501: reading file data, loading the file data into a code box and generating a histogram;
502: generating an ideal sine wave histogram;
503: subtracting the data histogram and the ideal sine wave histogram to obtain a differential nonlinear parameter;
504: and accumulating the differential nonlinear data step by step to obtain an integral nonlinear parameter.
The above is the process of analyzing the data of the computer-side script program, step 501 reads the data, loads the data into a code box according to the data value distribution, and generates a code density histogram; 502, generating ideal sine wave data, and loading the data into a code box to generate an ideal sine wave code density histogram; step 503, normalizing the data code density histogram obtained in step 501, and subtracting the normalized data code density histogram from the ideal sine wave code density histogram generated in step 502 to obtain differential nonlinear parameter data; and step 504, accumulating the differential nonlinear parameter data obtained in the step 503 bit by bit to obtain integral nonlinear data.
All the steps of the method are completed to obtain differential nonlinear and integral nonlinear parameter data. Because differential nonlinearity and integral nonlinearity are static performance characteristics of analog-to-digital conversion, when the code density histogram test method is used for testing relevant performance, the confidence coefficient of a test result can be ensured only by ensuring enough data quantity, so that in the test of a microcontroller built-in analog-to-digital converter without a high-speed interface and a large space cache, the sampling rate can be reduced, and the performance test of the differential nonlinearity and the integral nonlinearity can be completed by acquiring enough sampling data.
In another preferred embodiment, a computer-readable storage medium is also provided, on which a computer program is stored which, when being executed by a processor, carries out the above-mentioned method.
Those of ordinary skill in the art will understand that: all or a portion of the steps of implementing the above-described method embodiments may be performed by hardware associated with program instructions. The program may be stored in a computer-readable storage medium. When executed, the program performs steps comprising the method embodiments described above; and the aforementioned storage medium includes: various media that can store program code, such as ROM, RAM, magnetic disks, removable storage devices, or optical disks.
The above description is only an embodiment of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art should be able to make modifications or substitutions within the technical scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the appended claims.

Claims (9)

1. A method for testing differential nonlinearity and integral nonlinearity of an analog-to-digital converter of a microcontroller is characterized by comprising the following steps:
s1: the signal generator generates a sine wave with a preset frequency as a test signal;
s2: the microcontroller samples the test signal by adopting an analog-to-digital conversion sampling frequency with a preset rate;
s3: the microcontroller adopts a serial port to send sampling data;
s4: the computer end receives the sampling data and stores the sampling data into a file;
s5: and analyzing the data of the file by the computer by adopting a code density histogram method to obtain a test result.
2. The differential nonlinearity and integral nonlinearity test method according to claim 1,
the step S3 includes: the microcontroller carries data in a double DMA mode and then sends the data through a serial port.
3. The differential nonlinearity and integral nonlinearity testing method according to claim 2, wherein said microcontroller performs data transfer in dual DMA mode, comprising the steps of:
s31: firstly, a first DMA is responsible for carrying sampled data and storing the data into a memory cache;
s32: after the first DMA finishes the data transportation of the preset quantity, a second DMA starts to transport the data in the memory cache to a serial port sending register;
s33: and after the second DMA finishes the data transfer of the serial port sending register, returning to the step S31 to enter the next round of data transfer of the first DMA.
4. The differential nonlinearity and integral nonlinearity test method according to claim 1, 2 or 3, wherein said step S1 is preceded by: firstly, determining the working rate of the serial port, including:
determining the maximum working rate supported by the serial port of the current microcontroller;
and determining the working rate of the serial port to be any value smaller than the preset range of the maximum working rate.
5. The differential nonlinearity and integral nonlinearity test method of a microcontroller analog-to-digital converter according to claim 4, wherein after determining the operating rate of the serial port, further comprising:
determining the sampling frequency of the analog-to-digital conversion at the preset rate as follows: the working speed determined by the serial port of the current microcontroller is any value between 0.5 and 1.0 times.
6. The differential nonlinearity and integral nonlinearity test method according to claim 5, further comprising, after determining the preset rate of ADC sampling frequency:
determining the preset frequency of the sine wave as follows: less than 1/10 of the analog-to-digital conversion sampling frequency.
7. The differential nonlinearity and integral nonlinearity test method according to claim 1, 2 or 3, wherein in step S4, the computer-side program receives the sampled data using a buffer serial port with a length of not less than 2 megabytes.
8. The method for testing differential nonlinearity and integral nonlinearity of an analog-to-digital converter according to claim 1, 2 or 3, wherein in step S5, the computer uses a script program to analyze the data of the file by using a code density histogram method to obtain performance parameter test results of differential nonlinearity and integral nonlinearity.
9. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, is adapted to control the implementation of the method according to any one of claims 1 to 8.
CN202011386942.XA 2020-12-01 2020-12-01 Method for testing differential nonlinearity and integral nonlinearity of analog-to-digital converter of microcontroller Pending CN112526973A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011386942.XA CN112526973A (en) 2020-12-01 2020-12-01 Method for testing differential nonlinearity and integral nonlinearity of analog-to-digital converter of microcontroller

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011386942.XA CN112526973A (en) 2020-12-01 2020-12-01 Method for testing differential nonlinearity and integral nonlinearity of analog-to-digital converter of microcontroller

Publications (1)

Publication Number Publication Date
CN112526973A true CN112526973A (en) 2021-03-19

Family

ID=74995950

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011386942.XA Pending CN112526973A (en) 2020-12-01 2020-12-01 Method for testing differential nonlinearity and integral nonlinearity of analog-to-digital converter of microcontroller

Country Status (1)

Country Link
CN (1) CN112526973A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115473532A (en) * 2022-11-01 2022-12-13 英彼森半导体(珠海)有限公司 DNL performance test system and method of ADC

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2002259326A (en) * 2001-02-27 2002-09-13 Canon Inc Dma controller and dma transferring method
CN102768336A (en) * 2012-07-20 2012-11-07 中国科学院深圳先进技术研究院 Built-in self-test system based on on-chip system or system-in-package
CN206412999U (en) * 2016-10-10 2017-08-15 上海灵动微电子股份有限公司 A kind of ADC dynamic test systems
CN111324567A (en) * 2020-02-10 2020-06-23 华大半导体有限公司 Method for realizing serial port communication and single chip microcomputer system

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2002259326A (en) * 2001-02-27 2002-09-13 Canon Inc Dma controller and dma transferring method
CN102768336A (en) * 2012-07-20 2012-11-07 中国科学院深圳先进技术研究院 Built-in self-test system based on on-chip system or system-in-package
CN206412999U (en) * 2016-10-10 2017-08-15 上海灵动微电子股份有限公司 A kind of ADC dynamic test systems
CN111324567A (en) * 2020-02-10 2020-06-23 华大半导体有限公司 Method for realizing serial port communication and single chip microcomputer system

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
刘明峰 等: "一种 A/D 测试平台的设计", 《电子与封装》 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115473532A (en) * 2022-11-01 2022-12-13 英彼森半导体(珠海)有限公司 DNL performance test system and method of ADC

Similar Documents

Publication Publication Date Title
CN110109853B (en) Data acquisition and processing device and method
CN109060592B (en) Shale loss gas quantity obtaining method and device and terminal equipment
CN112526973A (en) Method for testing differential nonlinearity and integral nonlinearity of analog-to-digital converter of microcontroller
CN104076214B (en) Multi-channel microwave module automatic test method
CN102539864B (en) Digital oscilloscope and signal measurement method
CN107290654A (en) A kind of fpga logic test structure and method
CN108984374B (en) Method and system for testing database performance
US8706445B2 (en) Measurement apparatus, program, recording medium, and measurement method
CN115047065A (en) Method, device and equipment for correcting impact of knocking force in beating method
CN108631781B (en) Method and apparatus for determining nonlinearity of a mode/digital converter
US6799128B2 (en) Measurement system for sampling a signal and evaluating data representing the signal
US9453863B2 (en) Implementing frequency spectrum analysis using causality Hilbert Transform results of VNA-generated S-parameter model information
CN117033093A (en) Chip verification device and method, electronic device, and computer-readable storage medium
LU502236B1 (en) Structured data parsing method and apparatus, electronic device and storage medium
CN115901943A (en) Method and system for detecting internal cavity
US20130191598A1 (en) Device, system and method of accessing data stored in a memory
CN109165171B (en) Self-adaptive fast digital waveform imaging method
CN113219310B (en) Partial discharge positioning method, device, positioning equipment and storage medium
CN107483122A (en) Power test system, power compensating method and device
CN112566005B (en) Audio chip testing method and device, electronic equipment and storage medium
CN114257243A (en) Method and system for audio decoder segment delay measurement
CN201060250Y (en) Digital type alternating current-direct current local discharge testing apparatus
CN103944572A (en) Superspeed sampling rate acquisition apparatus and method
CN215575702U (en) Signal phase analysis device
CN203012130U (en) Superspeed sampling rate acquisition apparatus

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20210319

RJ01 Rejection of invention patent application after publication