XIAO ADC problem

Have you tried SAMD_AnalogCorrection?
The ADC gain and offset correction values are calculated.

https://sigmdel.ca/michel/ha/xiao/seeeduino_xiao_01_en.html