PWM signal corrupted on pin 6 but not pin 5

I'd investigate the issue by un-complexifying the code and circuit in stages until the problem goes away, then add a bit back to verify that's the cause.