Go Down

Topic: Pwm output is high on bootup? (Read 3 times) previous topic - next topic

Coding Badly

Is the glitch also present on digital pin 3 (PD3/OC2B)?

nali2001


Coding Badly

I hate to continue sending you on "little errands" but it will help to definitively isolate the offending line(s) of code.

Is there a glitch present on digital pin 5 (PD5/OC0B)?

Is there a glitch present on digital pin 6 (PD6/OC1B)?

Is there a glitch present on digital pin 9 (PB1/OC1A)?

Is there a glitch present on digital pin 10 (PB2/OC1B)?

Which Arduino IDE version are you using?

Is the second PWM output from you adjusting the potentiometer?

How does this behave...

Code: [Select]
int Pwm_output_pin_11 = 11;

void setup()
{
  pinMode(Pwm_output_pin_11, OUTPUT);
  analogWrite(Pwm_output_pin_11, 128);
}

void loop()
{
}

nali2001

Hi Coding Badly,
Thanks for the input I appreciate it!
I have tried pin 5, 6, 9 and 10 just now and it's the same problem for each pin.
Then I tried your code on each of these pins as well, and indeed it's the same situation. The output goes high for a short moment, then low and after a small pause it is up again and running.

Yes the moving pwm in the video is me adjusting the potmeter.

Found something else...
When you power the Arduino from a 9volt battery the problem is gone. It also seems like it boots multiple times faster that way. You plug in the power and a second later the thing is running, the short 'high' pwm problem is gone when run from battery.

So maybe the usb data connection initialization is causing the problem as well as the way slower boot time?
I wonder how to solve this usb situation...

Booting powered from 9v battery  = 2 seconds. (no brief output going high problems during boot)
Booting from plugging in the usb cable = 7 seconds. (brief output going high problems during boot)

Thanks,
Steven


Coding Badly

Which Arduino IDE version are you using?

Go Up