When I setup timer 3 on my 1284p in the following way (and many, many others) I get a unpredictable start state. The OCR3A pin always ideals at 0 since I set both TCCRA and B to 0 when the timer is off. FOC3A does not work in any of the PWM modes, which I need. It also does not produce the desired outcome in CTC mode, but that's another issue for another day.
After the following code is executed I get a short pulse, about 200ns wide, then the output is off for the correct period and on for the correct period and everything behaves as expected. Where is this pulse coming from and how do I get ride of it? I want the timer to start low every time.
Please keep in mind I need this to execute quickly so setting several different modes just to make some inaccessible pin toggle register happy may not an option.
ICR3=(PW); //cycle pulse width OCR3A=(PW/2); //output PW off time TCNT3=40; //set timer 3 start value TCCR3A =(0<<COM3A0)|(1<<COM3A1)//clr compare match b.6 TCCR3B =(1<<WGM33)|(1<<CS30);//tmr3-clk/1, P/F PWM
Any ideas?