ok i found the problem!
I was getting the reference voltage from a 3.3V source but i was connecting it to the AREF pin through a 5K resistor (as suggested in the analogReference page) which of course was decreasing the voltage to 2.95V.
Now i connected it directly to the 3.3 source and it is correct.
![]()