Problem with arduino Mega2560 PWM programming

Hello,

I'm working on a robotics project at my engineering school and I'm stuck with a problem.
I've made a mistake with an electronic card I made, I'm using pins 3 and 14 (timer 0) and 9 and 10 (timer 2) to drive two motors. For my setup I need 2 perfectly in sync opposite PWM signals for each motor.

I foolishly based it off another site where I saw 31kHz as the max value for both when in actual fact its 62khz or so for the timer 0.
I need a frequency between 20 and 40Khz to drive my motors, and I'm stuck with 62kHz or 7.8kHz on pins 3 and 14 depending on if i use a prescaler of 0x01 or 0x02.
I either need to figure out some way to get this working correctly or will need to do something totally messy like scrape part of my card off and solder wires to link to PWM outputs for another timer.

I've been struggling with the details of the datasheet for the Atmel processor on the arduino mega2560.
I've seen a few options that might work but so far having no luck, I'm wondering if anyone has tried these before?

  • Using a PWM configuration on 9 or 10 bits instead of 8 which may force a lower frequency
  • Using something other then base PWM mode but instead one of those "compare" things where I manually make it switch to a high or low value at a given time that might let me influence frequency
  • Configure the PWM to run based off an external clock and somehow use another timer like timer 1 or 2 either via a physical hookup or some coding

Really stuck, could use some help! Thanks a lot