A correlation-code sign-counting method to detect third-order nonlinear errors in an Analog-to-Digital Converter (ADC) comprising:
- (a) receiving a reference code that is output by a reference channel having a reference ADC receiving an attenuated analog input generated by attenuating an analog input;
- receiving a nonlinear-corrected code from a nonlinear channel corrector, the nonlinear channel corrector receiving a data code output by a data channel having a data ADC receiving the analog input;
- generating a correlation code by generating a difference of the nonlinear-corrected code and the reference code, and multiplying the difference by the reference code;
- incrementing a counter when a sign of the correlation code is negative, and not incrementing the counter when the sign of the correlation code is positive;
- repeating from (a) for M samples of the analog input, wherein M is a whole number of at least 16384 and the analog input changes over a range of the analog input;
- calculating a cost function by doubling a count value of the counter and subtracting M;
- resetting the count value when the cost function is generated;
- updating a loop coefficient by subtracting a stepsize multiplied by a sign of the cost function from a prior value of the loop coefficient;
- averaging the loop coefficient to generate an averaged third coefficient;
- repeating from (a) for at least K values of the cost function, wherein K is a whole number of at least 256;
- generating the nonlinear-corrected code using the nonlinear channel corrector by adding a third term to a code input to the nonlinear channel corrector from the data ADC, and generating the third term by dividing the code input by a range of the code input to get a normalized code value, cubing the normalized code value to get a cubed value, and multiplying the cubed value by the averaged third coefficient to generate the third term,
- whereby third-order harmonic distortion (HD3) errors are detected and corrected using the counter incremented by the sign of the correlation code.