Source of error DAC - ADC reading
What you are observing are actually missing codes, it is a hardware related issue that can come from the DAC and/or the ADC. It is not coming from your software. You can have a look at this question that explains a similar issue.
What you can do first is to ensure that the DAC voltage settling time is respected before you launch a conversion on the ADC side.
If you can test other ADC architectures, I suggest to do so. The ADC you are using is built around a successive-approximation-register algorithm. Depending on your specifications, you may find a sigma-delta or a pipeline ADC that can fits your needs.
You can read this paper that describes the non-linearity issue and you can refer to this page just to ensure you are using the right ADC for your application.