<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Change the pwm frequency</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/22272/change-the-pwm-frequency</link><description>hi,
I follow the pwm routine, 51822 can work and output pwm, when I want to change the frequency of pwm encountered a problem, the program reset.
I use the method when i need to change the pwm frequency when i reinitialize pwm_init 
 void Motor_Pwm_Init</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 23 May 2017 12:11:11 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/22272/change-the-pwm-frequency" /><item><title>RE: Change the pwm frequency</title><link>https://devzone.nordicsemi.com/thread/87573?ContentTypeID=1</link><pubDate>Tue, 23 May 2017 12:11:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f6ed5847-b9da-46c9-a90c-ff33ceb3c029</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Yes, note that the maximum PWM frequency is 1MHz on the nRF51.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Change the pwm frequency</title><link>https://devzone.nordicsemi.com/thread/87572?ContentTypeID=1</link><pubDate>Tue, 23 May 2017 11:57:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6a4eb92e-8186-4722-89d9-0d1d39dc04b4</guid><dc:creator>muyang</dc:creator><description>&lt;p&gt;According to your method, the frequency can be arbitrarily changed&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Change the pwm frequency</title><link>https://devzone.nordicsemi.com/thread/87571?ContentTypeID=1</link><pubDate>Tue, 23 May 2017 11:49:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cebd0aa2-fc0a-4976-bf95-bedd6a31217a</guid><dc:creator>muyang</dc:creator><description>&lt;p&gt;Thanks for your answer, I try to do it the way you do it&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Change the pwm frequency</title><link>https://devzone.nordicsemi.com/thread/87570?ContentTypeID=1</link><pubDate>Tue, 23 May 2017 11:45:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:40cc6ac4-2a9d-404b-8dbf-4349d3ba55a4</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Yes, if you want to change the PWM frequency on the nRF51 you will need to re-initialize the PWM. Remember to call &lt;code&gt;app_pwm_disable(..)&lt;/code&gt; and &lt;code&gt;app_pwm_uninit(..)&lt;/code&gt; before calling &lt;code&gt;app_pwm_init(...)&lt;/code&gt; and &lt;code&gt;app_pwm_enable(..)&lt;/code&gt; again with the new configuration. If the device is still resetting, try debugging to find the error code.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Change the pwm frequency</title><link>https://devzone.nordicsemi.com/thread/87569?ContentTypeID=1</link><pubDate>Tue, 23 May 2017 11:41:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:14a3bbcb-435c-447b-a9fe-1a84d23097ff</guid><dc:creator>muyang</dc:creator><description>&lt;p&gt;I can think of the way is to re-initialize pwm, but I re-initialize pwm when there was a reset&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Change the pwm frequency</title><link>https://devzone.nordicsemi.com/thread/87568?ContentTypeID=1</link><pubDate>Tue, 23 May 2017 11:40:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:eaff6dde-fe6b-43db-9370-a9485492f62f</guid><dc:creator>muyang</dc:creator><description>&lt;p&gt;Duty cycle can be modified, my question is how to modify the frequency&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Change the pwm frequency</title><link>https://devzone.nordicsemi.com/thread/87567?ContentTypeID=1</link><pubDate>Tue, 23 May 2017 11:33:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a7f7ef40-1d3d-46ea-b574-6d64adf3c485</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Note that you don’t need to reinitialize the PWM in order to change the duty cycle. A reset indicates that you are running into the error handler, where the default behavior is to do a reset. You should then debug in order to find the reason for the reset. See &lt;a href="https://devzone.nordicsemi.com/question/60125/my-device-is-freezing-and-restarting/"&gt;this post&lt;/a&gt; about debugging&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>