PWM change frequency

does a way exist for changing frequency on Arduino DUE ?
I 'd like to change frequency of PWM to drive stepper motor by using the TB6600 stepper driver

It used to be the case (1.5 beta) that you had to change a #define of PWM_FREQUENCY in a variants.h
file I think. I've not checked what happens in 1.6.x with the Due yet though, perhaps they've fixed this.

hi Mark
I need to change the frequency continously , to drive stepper motors

You mean you are generating step pulses, not using PWM? That's a different problem and
would normally attacked by explicitly setting timer values or using a fixed sampling rate
and DDS style phase accounting.

There is a way to do this. I'm using PWM with a duty set to 50% and varying the PWM frequency in order to drive automotive gauges. Things like speedo's and tachs want a variable number of pulses to as input. I've tested and this works very well if you do the 50% duty and vary the frequency. The Due can do this perfectly fine.

I was able to do this with a library called pwm01.h and the author listed is randomvibe. However, even that library really wasn't setup for variable frequency. So, I edited it to allow me to change frequency on the fly. Works slick. So, you can edit that file (it's pretty easy) or I could add the pwm01 library to my ever growing list of modified libraries that I host on github and you could grab it there. But, if you use my version it's going to be geared for what I wanted it to do and that might not be quite what you wanted it to do. Also, that library only works on pins 6-9 of the Due. There are other "pwm" pins on the Due but they don't use the actual hardware pwm and so the library doesn't support them.

BTW, if you do want to check out my version it's here: GitHub - collin80/pwm01: Enhanced PWM library for Arduino Due

x Mark : yes I need PWM , at 50% duty , to drive stepper motor
I'm trying also with Arduino Due by creating 3 trains of pulses into the timers handler .It works but when I change the speed so the frequency I have to change the preset of the timer and this cause some asincronous problems .
I think the Collin's solution is the best .Very good Collin
I'm taking a look also at the AccelStepper library .It seams that's good to drive stepper motors over the TB6600 drivers ....
Collin do you have an example .ino of your library?