ADC SAR missing codes
I had exactly the same problem 35 years ago, when a 25ks/s 12 bit ADC was serious money. Yours may not be due to the same problem, but it's a source of potential problems worth ruling out.

I had crosstalk from some of the data output lines to the analogue input, due to a poor layout. The ADC ground shared a ground badly between the data latches and the input sample and hold. The symptom was that for a slowly changing input signal, the output code 'stuck' at particular codes.

Crawl all over your input and output lines, checking for capacitive coupling, and their ground return paths checking for common ground coupling.

A simpler and more trustworthy test source than a function generator is a large capacitor, shunted by a resistor, connected directly to the ADC input and its respective ground or -input. After charging, the discharge will give a smooth ramp, with no extraneous currents to anywhere else in the circuit.