I've been trying for hours to change the PWM frequency of my Arduino Due to a value between 15kHz...18kHz but nothing worked. I found this manual https://folk.uio.no/jeanra/Microelectronics/GettingTheBestOutOfPWMDue.html to change the PWM resolution to 12bit and the frequency to 20kHz which works very well. Now my question: if it's possible to change the PWM-Frequency to a value between 15kHz...18kHz with a resolution of 11 or 12bit, how can I do this? The pins I want to change are number 6, 7, 8 and 9. I use the command analogWrite(pin, value) for changing the PWM outputvalue.

Thanks in advance for your help.


  • 1
    Using frequencies that are not a power of 2 magnitude lower than the system clock requires using a reduced resolution. – Ignacio Vazquez-Abrams Jan 10 '18 at 17:57
  • So it need to work with 11bit oder less? I also tried using a resolution of 10 bit but it didn't work too. – Guss0302 Jan 10 '18 at 18:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.