PWM Frequency On Dual MC33926 Motor Driver

Is it possible to change to the PWM frequency for the Pololu Dual MC33926 Motor Driver Shield for Arduino?

I want to be able to drive my motors at 15 kHz. How would I go about this? I’ve successfully used this shield in the past, but I didn’t care about the driving frequency at that time.

Thank you!


Yes, you can modify the MC33926 motor shield library to change that frequency. Lines 52-56 of the motor shield C++ file contain code and comments for PWM frequency calculation. You could modify your library by changing the timer register values there, or reassign them later in your sketch.


Hello Jon,

Thank you. I’m not familiar with interacting with the timers directly. So can I assign the value of ICR1 (top) willy-nilly such that I get the frequency I desire? (that is, in this case I would make it 533 so that I get 15 kHz).

In general, microcontroller registers have a range of values they can safely be assigned. ICR1 is a 16-bit register, which means it can be assigned integers from 0 to 65535, so setting it to 533 should be fine (and make the PWM frequency about 15kHz). You can find more about how to adjust the timer registers that control PWM frequency in the datasheet for the AVR microcontroller on your specific Arduino.


Thanks Jon! I’ll be ordering the driver today. :slight_smile: