Due PWM & H-bridge motor control.


I'm working to get my Due to control to drive a Robot Power MegaMoto shield...

It looks like I can use the MegaMoto to do just about everything I want to do, from driving servos to driving 3ph brushless DC motors! So fabulous...


... all of the PWM libraries I have found so far for Due seem to be limited to using pins 6-9 for output. Apparently the Due is supposed to have 13 PWM channels? I am wondering why the 6-9 limitation is there, and how to get around it?

The immediate problem is that the MegaMoto can be configured to use D5, D10, or D3 for its channel B PWM input. None of those channels are within the 6-9 range!

For the time being I've written a software PWM that uses timers and interrupts to provide PWM on whatever pin I want... and this works. But this approach is a kludge at best, it is super high overhead, and it is going to really limit what else I can do with the chip down the road. I know that the SAM chip is capable of a lot more and I want to do it right!

I'm really not sure how to get access to the super cool SAM capabilities.

Any suggestions?



Hi I work on the same project too

try to use the ASF example pwm_synch with some modifications it will enable you to get 3 pwm channels which works synchronous to each other ...

Please tell me if you have any code devoplments