Go Down

Topic: DUE PWM Frequency (Read 22 times) previous topic - next topic

so3ody

Quote
how can these forums help new people, like you, to post better questions?


Well I think that a software is always a buzzle of small parts.

And I beleive that there are standard things in my casw " H Bridge driver via Arduino Due"

I think itsa good idea after such a project really works. to test it as an admin or  user and make a small doecumentation like

Used  methods : PWM, Sine wave esc. and then write " tested and works"

So this will mean that I will not start from the beginning and that I will just concentrate my self on my problem

I saw in my case that my problem was mentioned in like 5 threads and really no one have a decent answer for it


webuser


Had a quick look at it and I can confirm that changing PWM_FREQUENCY in
https://github.com/arduino/Arduino/blob/ide-1.5.x/hardware/arduino/sam/variants/arduino_due_x/variant.h#L182 does change the freq. So if you just need the 4k freq it'll work fine. Still, a way to change the freq in the sketch would be preferred.


Thank you, It works! mine I change the value to 500 for 500Hz PWM freq (intended for motor ESC) and tested it
on simple code below which create a positive pulse of 500us in a 2ms period (500Hz) :
/*
By default, PWM Output Frequency is 1000Hz.
To change it by changing the PWM_FREQUENCY constant in the file variant.h
on folder C:\Program Files (x86)\Arduino\hardware\arduino\sam\variants\arduino_due_x\variant.h
and look for line " #define PWM_FREQUENCY  1000 "
*/

const int Resolution=12, Pin=12, PosPulse=500;
void setup(){ 
  // make our digital pin 12 an output
  pinMode(Pin, OUTPUT); 
}

void loop()
{
  analogWriteResolution(Resolution);
  analogWrite(Pin, PosPulse*2.05); //always multiply by 2 something
  delay(5);
}

randomvibe


@webuser, just so you know, you can change frequency in your sketch using the "pwm01.h" library written and tested for the Due.  It also allows you to open two PWM channels simultaneously with different frequencies.  The link below has an example (2Hz and 5000Hz) and the library itself (login to download).  Good luck.

http://forum.arduino.cc/index.php?topic=144446.msg1149044#msg1149044


webuser

That's great! I look forward to try that. Thanks.

mrburnette

Quote
I keep hoping to find a way to impress on people like this how to better ask their questions.


Could the webmaster not just invoke a template on all members classified as "newbies" to enforce a common dialog that would request the needed information?  After their newbie status matures, this restriction can be removed, or earlier if the moderator(s) think it is appropriate.  By "pulling the information" from the user, it puts the need into the correct context for a proper answer from the more seasoned members.  It would also stop (or should severely reduce) the very negative comments from senior members about code, board type, and other items. 

The forum software runs on a computer - heck, it should be smart enough so that a newbie does not have to be blasted or embarrassed for asking a question.  And the code insert part of the template could force the
Code: [Select]
attributes which would be a major improvement!


Ray

Grumpy_Mike

Quote
The forum software runs on a computer - heck, it should be smart enough ......

But no it isn't.
Apparently treating posters differently depending on their number of posts is an almost impossible thing to do with this software, or so I am told.
Like most forums the webmaster has not written it from scratch but rather customizes it.
Therefore what you might consider a simple thing to do is not always possible. 

mrburnette

#66
Mar 29, 2014, 01:18 am Last Edit: Mar 29, 2014, 01:58 am by mrburnette Reason: 1
Quote
Therefore what you might consider a simple thing to do is not always possible.


Fair enough.  So, it can be done but either licensing, customization fund$, or laziness/inexperience stands in the way of implementating something new.  40 years in military, university research, or corporate 100 and I put my money on not wanting to deviate from the base package because of increased costs and testing during version updates.

In engineering university back in the dark ages of lunch punch cards, my fortran professor stated, "There is nothing you cannot do with a computer (pregnant pause), If you have enough time and enough money."  I have long sense forgotten his name, but never his insight into equating computing with finance.


Ray

Paul Stoffregen

Even if these things are difficult or impossible today and here on this forum, they may not always be so unattainable always and everywhere.

Incomplete, time-wasting questions are a huge problem on every forum that tries to offer support for novices on technical platforms.  As the technology becomes more advanced and even more absolute beginners enter the community, it's an ongoing problem that's becoming more and more worthy of difficult work to customize forums.

Of course, as the creator of Teensy, I'm interested in trying to improve the PJRC forum.  I'm also interested in sharing these types of improvements, just like I try to contribute Teensy's improvements back to Arduino (which is another excellent example of something that isn't always easy or even possible, but still worth trying).  Helping beginners is something I care about doing.  Every day I answer lots of questions.  Every day, I waste time asking people to post info they should have put in their original question.  Every day, I see conversations that would have produced useful or more relevant answers if only the question had included better info.

Even if the ideas get tried first on my own forum, or any of the many other forums for various arduino-compatible boards, I think it's worthwhile to brainstorm ideas.  Even if they're "hard" in the context of today's forum software, in the long term some way to improve is needed.

Things will only get better if someone tries.  I know I want to, even if I have to dig into thorny forum customization/programming.  I'm really interested to hear any ideas of how forums could guide novices to ask better questions, so they get better answers and everyone's time is wasted less.  Even if those ideas seem impossible on today's forum systems, time, persistence and ingenuity have a way of making anything possible in the long run.

Go Up