Why is the REFCLKO signal on the PIC32 not a square wave with a 50% duty cycle?
This depends on the frequency chosen and the source for the reference clock. The fractional part of the REFCLK divider, REFOTRIM, is actually an averaging circuit, meaning that it doesn't actually produce a fractional frequency of the input source clock. Instead, the circuit steals REFCLK input cycles so that the resulting average clock output frequency over a period of time averages out to the expected frequency. How often the trim circuit steals REFCLK input cycles is dependent on the fractional remainder of the desired REFCLK trim bits (e.g., (2 * REFOTRIM ) ÷ 512).