Go Down

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

nali2001

Hello all,
Very sorry for the double post. I removed the other.

Here is some additional info:

The circuit:


And here is a video:
http://home.planet.nl/~sintt000/Arduino.wmv

You can see that after the usb cable is plugged in you see the pwm signal very briefly, then it goes away and after a while the booting is done and the board is ready to use.

But this short pwm output during booting is not wanted when driving H bridges and such.

The Arduino board was bought about 4 months ago.

The code:
[font=Verdana]int Pwm_output_pin_11 = 11;
int Potmeter_pin = 0;
int Potmeter_value = 0;

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

void loop()
{
  Potmeter_value = analogRead(Potmeter_pin);
  analogWrite(Pwm_output_pin_11, Potmeter_value / 4);
}
[/font]

retrolefty

#6
Feb 11, 2011, 06:11 pm Last Edit: Feb 11, 2011, 06:12 pm by retrolefty Reason: 1
A quick experiment. Load the IDE example blink program into the arduino and then disconnect and reconnect the USB cable and see if your scope still shows the pin #11 PWM signal or not during the bootloader initialization.

Lefty

nali2001

Hi Lefty,
Thanks for the suggestion. I tried that and no, pin #11 stays low on startup, but in the code it is not initialized either.
But pin #13 is initialized in the code, so I tried that one next. And yes during boot-up that one also goes though some high cycles before normal operation is started.

Any idea?
Anyone else here with a scope who can test this?

Many thanks!
Kind regards,
Steven

Coding Badly

Quote
I tried that and no, pin #11 stays low on startup


That rules out the bootloader.

How does this behave...

Code: [Select]
int Pwm_output_pin_11 = 11;
int Potmeter_pin = 0;
int Potmeter_value = 0;

void setup()
{
 pinMode(Pwm_output_pin_11, OUTPUT);
 Potmeter_value = analogRead(Potmeter_pin);
 delay( 50 );
 Potmeter_value = analogRead(Potmeter_pin);
 delay( 50 );
 Potmeter_value = analogRead(Potmeter_pin);
 delay( 50 );
}

void loop()
{
 Potmeter_value = analogRead(Potmeter_pin);
 analogWrite(Pwm_output_pin_11, Potmeter_value / 4);
}

nali2001

Hi Coding Badly,
Thanks for the code.
I tried it and here are the results:
home.planet.nl/~sintt000/Arduino2.wmv

The video starts the moment I plug in the usb cable. Almost directly a high output, then a little while nothing, then the board is ready to go.

Thanks
Kind regards,
Steven




Go Up