31 kHz should work fine. It's not clear why the motor datasheet mentions a specific PWM frequency, but that should be a minimum frequency. Higher frequencies (unless you get much higher) shouldn't matter to the motor.
There are at least two reasons they might specify a minimum PWM frequency:
- Audible whine. Individual windings of the coils experience magnetic forces. These will cause some vibration, which can be audible and quite annoying. 25 kHz is often used because that is just above the hearing range of most people. The manufacturer may know that their windings will emit significant audible whine, so tell you to use a frequency you can't hear.
- Current smoothness. The current in the windings ramps up and down proportional to the applied voltage times time. The shorter the time, the smaller the variations about the average current. The ideal current is flat, with the actual current being roughly a sawtooth.
You want the variations to be small compared to the average. Only the average current drives the motor. The high frequency AC component doesn't push the motor forwards but still contributes to I2R heating. The manufacturer knows the inductance of the windings, and may have decided that 25 kHz is necessary to minimize wasted current to meet other specs.
Note that both these reasons set a minimum PWM frequency, but allow it to be higher. The main reason for not going too much higher is that the switching transitions in your circuit take a finite time, and at higher frequency this time is a larger fraction of a whole cycle. That means your circuit will be less efficient as the frequency goes up. However, that's under your control. You should be able to build a power driver that switches at 31 kHz without significant switching losses.