Everything stops working after I enable PWM
Most of what you describe sounds to me as though your ic2 is throwing unmasked interrupts that you are not handling. Enabling interrupts for you PWM would then make your main loop go wonky.