I do not know why the comparator does not compare correctly. I use AIN6 as Vin+; ANI0 as Vin-. The code is show in below. The comparator is work in differential mode.
The output of compare is show in below.
yellow line: input signal of comparator. Frequency: 10Hz; High voltgae: 0.5V; low voltage: -0.5V, Symm: 50%.
blue line: output of comparator.
Vin+ of the comparator is connected to the yellow line signal, the Vin- of comparator is connected to GND. Therefore, the duty cycle of blue line should be 50%. But now the duty cycle of
blue line is not 50%. I do not know why.
You're applying a voltage of -0.5V to AIN6 who's out of spec, Absolute maximum ratings: -0.3V
The signal is clipped at -0.3V because the ESD diodes kick in. Therefore your midpoint is 0.1V instead of 0.0V and the DOWN period will be much longer. I suggest you bias the input signal to 0.5V and use 0.5V as the voltage reference.