Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

PWM maximum frequency


  • Please log in to reply
10 replies to this topic

#1 Flores

Flores

    Advanced Member

  • Members
  • PipPipPip
  • 64 posts

Posted 04 August 2010 - 11:22 AM

Hi, Very cool project. I've been through the specs of the processor but can't find the answer to what the maximum frequency of the PWM is. Does anybody know?

#2 CW2

CW2

    Advanced Member

  • Members
  • PipPipPip
  • 1592 posts
  • LocationCzech Republic

Posted 04 August 2010 - 11:28 AM

I've been through the specs of the processor but can't find the answer to what the maximum frequency of the PWM is.

Please have a look at page 426 for waveform period formulas.

#3 Flores

Flores

    Advanced Member

  • Members
  • PipPipPip
  • 64 posts

Posted 04 August 2010 - 11:49 AM

Please have a look at page 426 for waveform period formulas.


Does that mean there is no hardware limitation? Based on my calculations I can easily go above 20Kkz.. is that correct?

Thanks

#4 CW2

CW2

    Advanced Member

  • Members
  • PipPipPip
  • 1592 posts
  • LocationCzech Republic

Posted 04 August 2010 - 12:37 PM

Does that mean there is no hardware limitation? Based on my calculations I can easily go above 20Kkz.. is that correct?

Sure there is hardware limitation, but you can easily have 20 KHz PWM on ~20 MHz uC. Or do you mean 'software' PWM, i.e. toggling pin after some delays?

#5 Flores

Flores

    Advanced Member

  • Members
  • PipPipPip
  • 64 posts

Posted 04 August 2010 - 12:41 PM

Okay cool thanks. I mean the build in PWM.

#6 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 04 August 2010 - 02:04 PM

Very cool project. I've been through the specs of the processor but can't find the answer to what the maximum frequency of the PWM is.

Does anybody know?


In the first Netduino firmware, we've set PWM at 10KHz but we can go much higher than 20KHz (MHz PWM anyone?). In the first update (going into beta within the next two weeks), we'll be adding the ability to set your own clock speed.

Actually, there are _two_ clocks--so if it would be useful we could actually let you set both of those independently! And we can let people do center-aligned vs. left-aligned PWM, etc. The big thing to be careful with is making the object model simple enough for people who have never used PWM...but powerful enough for people that want to have total control.

I'll be starting a thread, probably next week, asking for feedback on what amount of control you'd like to see. If you have feedback in the meantime, please reply here--and then we'll consolidate it all internally.

Welcome to the community!

Chris

#7 Flores

Flores

    Advanced Member

  • Members
  • PipPipPip
  • 64 posts

Posted 04 August 2010 - 02:11 PM

Chris, Thanks for the information. In my application I want to be able to modify the pulse width based on an analogue input, and use the netduino as a controller for a mosfet dimmer, with a frequency above 16Khz. So for me just being able to modify the pulse width from 0 to 100% would do. Thanks

#8 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 04 August 2010 - 02:35 PM

Thanks for the information. In my application I want to be able to modify the pulse width based on an analogue input, and use the netduino as a controller for a mosfet dimmer, with a frequency above 16Khz.

So for me just being able to modify the pulse width from 0 to 100% would do.


So, let me see if this would work for you:
1. Create a PwmClock feature which lets you set the PWM clock frequency
2. You can then use the PWM.SetDutyCycle(...) method to control the pulse width

Does that work for your needs?

This is great feedback...

Chris

#9 Flores

Flores

    Advanced Member

  • Members
  • PipPipPip
  • 64 posts

Posted 04 August 2010 - 03:08 PM

Yes, And it would be great if the SetDutyCycle would take a floating point percentage (in my case). ...as I think of it, an integer would probably also do.. Thanks.

#10 Websteria

Websteria

    Member

  • Members
  • PipPip
  • 25 posts

Posted 27 August 2010 - 09:10 PM

I was just playing with this getting an LED to light up and it seems like when I ramp the Duty Cycle from 0-100 then I see light change, but what happens when the values go higher? Is the range really only 1-100? Thanks. Jeff

#11 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 27 August 2010 - 09:14 PM

The current PWM implementation uses a range of 0-100 for DutyCycle (a %). A 100% duty cycle is "always on". We're working on an update to PWM for the v4.1.1 firmware which will give you more raw control over PWM frequencies, etc. More to come on that... Chris




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.