From the PBP manual, HPWM statement.
The highest frequency at any oscillator speed is 32767Hz.
You can get 40khz from the CCP module, but you'll have to do it manually.
<br>