<?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>The PWM pluse width flutter on NRF52</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/46827/the-pwm-pluse-width-flutter-on-nrf52</link><description>I want to drive a servo by the PWM on nrf52832. The pwm cycle is 20ms and the duty is 1.5ms. But i have a problem that the duty is not precise when the BLE is working. I need a precise PWM with 1500us duty, but the duty will flutter randomly among 1500us</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 03 May 2019 13:12:03 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/46827/the-pwm-pluse-width-flutter-on-nrf52" /><item><title>RE: The PWM pluse width flutter on NRF52</title><link>https://devzone.nordicsemi.com/thread/185199?ContentTypeID=1</link><pubDate>Fri, 03 May 2019 13:12:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:997147f0-c85c-4cba-82a5-ab5b534593b9</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;The pointer to the event handler is only relevant if you want to know when the crystal oscillator has been started. For instance, if you want to start the PWM output as soon as possible, but not before the clock is stable. If you don&amp;#39;t need this callback/event, then you just pass a NULL pointer. It does not affect the stability of the system in any other way.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: The PWM pluse width flutter on NRF52</title><link>https://devzone.nordicsemi.com/thread/185185?ContentTypeID=1</link><pubDate>Fri, 03 May 2019 12:33:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:64024fa7-e049-40ce-8080-11515a3ef893</guid><dc:creator>tin39</dc:creator><description>&lt;p&gt;And I have a doubt that what is the input f&lt;span&gt;ormal parameter of the function&amp;nbsp;nrf_drv_clock_hfclk_request().&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I just use NULL, and it works. I am worry about that whether it will make the system unstable if I use NULL as the input parameter?&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: The PWM pluse width flutter on NRF52</title><link>https://devzone.nordicsemi.com/thread/185179?ContentTypeID=1</link><pubDate>Fri, 03 May 2019 12:20:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:94b0b226-1780-43a2-b1ce-a7a86a283975</guid><dc:creator>tin39</dc:creator><description>&lt;p&gt;It is awesome! It works I put the two functions after I initialize the SoftDevice. The pwm is never flutter. Many thanks!&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;And I did another try one hour age, and it&amp;nbsp;make the pwm no flutter too.&lt;/p&gt;
&lt;p&gt;I put the code below before I initialize the SoftDevice.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;NRF_CLOCK-&amp;gt;EVENTS_HFCLKSTARTED = 0;
NRF_CLOCK-&amp;gt;TASKS_HFCLKSTART = 1;
while (NRF_CLOCK-&amp;gt;EVENTS_HFCLKSTARTED == 0);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I guess that when the softdevice is initializing. The softdevice will check the HFCLK status. If the HFCLK is started, the SoftDevice will no longer disable the external crystal oscillator; If the HFCLK is not start, the SoftDevice will manage the crystal oscillator and disable the external crystal oscillator when it no longer needs it.&lt;/p&gt;
&lt;p&gt;Do my guess correct?&lt;/p&gt;
&lt;p&gt;And which method is better and more reliable?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: The PWM pluse width flutter on NRF52</title><link>https://devzone.nordicsemi.com/thread/185136?ContentTypeID=1</link><pubDate>Fri, 03 May 2019 10:38:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fe79fb2b-8b1f-4850-bc12-0767a93a9edc</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I was&amp;nbsp;not clear in my previous reply. You must move these function calls after initializing the SoftDevice for it to be persistent. If you do, the driver will use the SoftDevice API to request the clock, and this tells the SoftDevice to not disable the crystal oscillator when it no longer needs it. Can you try that?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: The PWM pluse width flutter on NRF52</title><link>https://devzone.nordicsemi.com/thread/185122?ContentTypeID=1</link><pubDate>Fri, 03 May 2019 09:48:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:232cdf39-9913-4960-9ac9-d5d029c80dba</guid><dc:creator>tin39</dc:creator><description>&lt;p&gt;Thank you for your reply!&amp;nbsp; I have try the two&amp;nbsp;functions you mentioned, I put them in the beginning of the application. But they are not working, the problem is still. I have monitor the&amp;nbsp;c&lt;span&gt;rystal waveform. The external 32MHz crystal is not always working. I think the softdevice is still switching the clock between the external 32MHz crystal and the interanl 64MHz oscillator.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: The PWM pluse width flutter on NRF52</title><link>https://devzone.nordicsemi.com/thread/184856?ContentTypeID=1</link><pubDate>Thu, 02 May 2019 11:41:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2c78136c-abf1-4a2e-bfc2-5da18c9b6386</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Both the PWM driver and PWM library should be as accurate as the HF clock. The reason is that the PWM peripheral (used by the driver) runs of the HF clock, and the PWM library use a TIMER which also use the HF clock, and controls the output via PPI, which is deterministic.&lt;/p&gt;
&lt;p&gt;Therefor I am tempted to think that the problem here could be related to your clock source. Can you try to request the HF clock with nrf_drv_clock_init() and nrf_drv_clock_hfclk_request() in the beginning of your application, and see if that helps? In that case the 32 MHz oscillator will always be used, instead of it being turned on only when the radio is on, and off otherwise.&amp;nbsp;When this is enabled, the (average) accuracy of the PWM signal will be the same as the accuracy of your 32 MHz crystal (which is the reference for the 64 MHz HF clock).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>