Setting PWM frequencies

I have an arduino uno. And I wanted to set out put frequencies. But I can get the required result on pins 6,9,10,11. This is the code is used. Please help
Below I have the code I am using.

#include <PWM.h>

//use pin 11 on the Mega instead, otherwise there is a frequency cap at 31 Hz
int pwm1 = 3;
int pwm2 = 5;
int pwm3 = 6;
int pwm4 = 9;
int pwm5 = 10;
int pwm6 = 11;
int32_t frequency = 20000; //frequency (in Hz)

void setup()
{
//initialize all timers except for 0, to save time keeping functions
InitTimersSafe();
InitTimers();

//sets the frequency for the specified pin
bool success1 = SetPinFrequencySafe(pwm1, frequency);
bool success2 = SetPinFrequency(pwm2, frequency);
bool success3 = SetPinFrequency(pwm3, frequency);
bool success4 = SetPinFrequencySafe(pwm4, frequency);
bool success5 = SetPinFrequencySafe(pwm5, frequency);
bool success6 = SetPinFrequencySafe(pwm6, frequency);

}

void loop()
{
//use this functions instead of analogWrite on 'initialized' pins
pwmWrite(pwm1, 125);
pwmWrite(pwm2, 125);
pwmWrite(pwm3, 125);
pwmWrite(pwm4, 125);
pwmWrite(pwm5, 125);
pwmWrite(pwm6, 125);
}

Frequency.ino (974 Bytes)

//initialize all timers except for 0, to save time keeping functions

That is your problem. On the Arduino UNO, two of the PWM pins (5 and 6) are driven by Timer0. Pins 9 and 10 are Timer1 and pins 3 and 11 are Timer2.

Hi. Thanks for the response. I've been able to get the outputs on 3,5,9 and 10. However I still can't get an output for 6 and 11.
Could someone please upload an appropriate code for this problem.
Thank you