Arduino Leonardo. PWM frecuency

Hi, searching I found the following info but I can´t confirm in any of Arduino official pages.
Arduino Leonardo (ATmega32U4)
pin 3 980Hz
pin 5 490Hz
pin 6 490Hz
pin 9 490Hz
pin 10 490Hz
pin 11 980Hz
pin 11 490Hz

Is this right?
I want PWM frecuency of PWM pins by default.
Regards.

The frequency isn't fixed, you can change it.

Those numbers don't sound right to me though.

Timer0 probably 1000Hz for the millis() timer.

The others are probably 500Hz because that's what Servo motors enjoy.

fungus:
The frequency isn't fixed, you can change it.

Those numbers don't sound right to me though.

Timer0 probably 1000Hz for the millis() timer.

The others are probably 500Hz because that's what Servo motors enjoy.

Hi, thanks for your reply.
I want to know the default frecuency without change it. ( analogWrite() )

lordk:
I want to know the default frecuency without change it. ( analogWrite() )

There's no "default" for the chip.

analogWrite() doesn't change the frequency. The frequencies are set in "main()" (ie. before setup()/loop() are called).

To amplify what fungus said, analogWrite changes the duty cycle, not the frequency.

Yes, you change duty cycle not frequency.

My question is. Without setting any frequency in setup(), what frequency do I get on pins 6 and 5 of Arduino Leonardo.

I found this:
http://forum.arduino.cc/index.php?topic=16612.0

lordk:
Hi, searching I found the following info but I can´t confirm in any of Arduino official pages.
Arduino Leonardo (ATmega32U4)
pin 3 980Hz
pin 5 490Hz
pin 6 490Hz
pin 9 490Hz
pin 10 490Hz
pin 11 980Hz
pin 11 490Hz

A quick test reveals that is correct:

void setup ()
{
  analogWrite (3, 128);  // 980 Hz
  analogWrite (5, 128);  // 490 Hz
  analogWrite (6, 128);  // 490 Hz
  analogWrite (9, 128);  // 490 Hz
  analogWrite (10, 128); // 490 Hz
  analogWrite (11, 128); // 980 Hz
  analogWrite (13, 128); // 490 Hz
}
void loop () {}

I measured each one and got the stated results.

I submitted a bug report:

The documentation is not only wrong for the Leonardo, it's wrong for the Uno as well. On the Uno, pins 5 and 6 have a PWM frequency of 976.57Hz (= 16MHz/16384). The other 4 PWM pins have a frequency of 490.20Hz (= 16MHz/(510 * 64)).

Lol, I didn't think to test that. I updated the bug report.

Great. Do you use a digital oscilloscope?

Yes. Mainly because I was too lazy to look at the source and puzzle out all those defines in the appropriate file.