I'm having a strange issue with analogWrite() and delay() within my program. I'm not exactly sure what the issue is since my code worked fine on my ardunio Uno but fails on a custom PCB using the ATMEGA328P-AU (same as arduino pro mini) at 5V and 16Mhz. I'm using two PWM outputs on pin 3 and pin 5. Here is what I have for debugging purposes.
void setup(){
pinMode(3,OUTPUT);
}
void loop(){
analogWrite(3,0);
delay(1000);
analogWrite(3,255);
delay(1000);
}
if I have that simple code, pin 3 never goes high, same results if I do digitalWrite(). Now if I start with analogWrite(3,255) and then set it low 1000ms later, it works. I figure its some timer/interrupt issue, but how I do i get around it without changing pins since I already have the PCB made. I don't even need to use PWM, digitalWrite would be fine.