Hello,
I currently have an Arduino Mega board and one of my needs is to produce PWM signal at high frequency (for example 30khz), and if possible with 12bits or 16bits resolution. I also plan to buy an Arduino Due to be able to do this and to have more power.
Concerning the PWM frequency, on Arduino Mega this is fine : when modifying TCCRxB register, I change the prescale, thus the frequency. So I can get the 30khz frequency. But concerning the 16-bits PWM, I haven't seen much information, and I don't know if it's possible to have this 16bits (or 10 or 12?) resolution. ( Well now i am pretty sure it's impossibe as I realise that 30k* 65k is about 2ghz... )
As this Mega board is too weak for my project, I thought "ok let's buy the new Arduino Due, with this powerfull Atmel 32 bits microcontroler it's probably easy to get some kind of 12bits PWM at high frequency"
But I get confused. The Atmel documentation of the SAM3X says
Up to 8-channel 16-bit PWM (PWMC) with Complementary Output, Fault Input, 12- bit Dead Time Generator Counter for Motor Control
But when I look at the analogWriteResolution() reference I can read
The Due has the following hardare capabilities:
- 12 pins with 8-bit PWM (as the other AVR based boards)*
- 2 pins with 12-bit DAC (Digital-to-Analog Converter)*
Here I talk about PWM pins, not DAC.
So, to sum up :
-
Can Arduino Mega produce PWM with 10 or 12bits resolution? at what frequency ?
-
Can Arduino Due produce PWM with 12 or 16bits resolution? at what frequency? How do we do this?
On Due if I write
analogWriteResolution(12);
analogWrite(PWMpin, 3017);
Will I really get a PWM with duty cycle 3017/4096 ?
Thanks for your answers