0
\$\begingroup\$

I want to generate complementary PWM on an Arduino due. For that purpose I am programming the cortex M3 using the PWMC library. In order to set the duty cycle I have to set a value in CDTY channel register of the Cortex M3.

The formula for calculating the duty cycle of a center aligned PWM is given in the SAM3X datasheet as,

enter image description here

Now I don't know what is the value of the variable "fchannel_x_clock" in this formula. If I get to know that, I can easily find the value of the CDTY to get my desired duty cycle using the above formula.

Link to the complete datasheet: http://www.atmel.com/Images/Atmel-11057-32-bit-Cortex-M3-Microcontroller-SAM3X-SAM3A_Datasheet.pdf

The formula above is in the PWM section of the data sheet.

\$\endgroup\$
  • \$\begingroup\$ Other than the frequency of the clock for channel x? \$\endgroup\$ – Ignacio Vazquez-Abrams Jul 19 '16 at 4:53
1
\$\begingroup\$

"fchannel_x_clock" is the frequency of the clock that you select when you program the PWM clock generator for that channel.

Take a look at section "38.6.1 - PWM Clock Generator" in that datasheet that you linked to.

\$\endgroup\$
  • \$\begingroup\$ Mark I dont think it is the frequency of the clock I have selected. The frequency of clock is 42MHz, and if I use this value to find the value of CDTY for a certain duty cycle I dont get a reasonable value for CDTY (the value comes out to be too large.) \$\endgroup\$ – Muhammad Faique Shakeel Jul 19 '16 at 16:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.