Any chance you have a floating enable pin tied to the PWM. 20 mS is 50 Hz,
also close to 16.66 mS (60 Hz).
The other is an improperly typed code loop, very unexpected stuff can
happen if the comipler does not catch it.
Without a project upload diagnosing this will be difficult.
Thanks for your response. The problem is now solved, it happened to be an artifact of the oscilloscopes sampling causing some aliasing! Kinda annoying after 8+ hours of debugging while thinking it was the PSoC's fault.
It wasn't like I was using a crappy scope (100MHz Rigol), but I borrowed a 1GHz Agilent and proved that the signal was actually fine.
Goes to show you can't always trust what you see :-)
I have a 2 Ghz DSO, and a full 1 Ghz analog always at hand for that very reason.