Author Topic: ARM M3 PWM and PMC settings  (Read 1719 times)

0 Members and 1 Guest are viewing this topic.

Offline tomshirvoTopic starter

  • Regular Contributor
  • *
  • Posts: 53
ARM M3 PWM and PMC settings
« on: November 14, 2014, 02:26:38 am »
Hi All,

I use the Arduino Due and my next project is big so I am converting everything to work in the Atmel Studio 6.2 software.

To be honest I am a bit of a noob but I am trying.

I have everything working and can get both the PMC and PWM to output a square wave. I have the PMC working at 40kHz.

I have been looking around the internet and I just can't seem to find anything about how to set all the values for the prescaler, pwm clock generator and period.

I want to have a period of 255 so my range is like that or the arduino. I have played around with the figures but can't get that 40kHz output.

Anyone have any good reading or some sort of calculation for get the desired output frequency?

It is a Due so the MCK is 84MHz and that is what I have it set as with "sysclk_get_cpu_hz()"
Only using clock a for the PWM as all channels will need to be at 40kHz.
 

Offline BennVenn

  • Regular Contributor
  • *
  • Posts: 160
  • Country: au
    • BennVenn's site
Re: ARM M3 PWM and PMC settings
« Reply #1 on: December 08, 2014, 12:00:30 am »
How did you go with your PWM troubles?

I work with STM32F103's coded in assembly so quite familiar with the registers required to get your hardware sorted. It is a different MCU but the basics still apply. Send me a message if you still need help
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: ARM M3 PWM and PMC settings
« Reply #2 on: December 08, 2014, 12:06:13 am »
You probably want to read the device datasheet.
================================
https://dannyelectronics.wordpress.com/
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf