<?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>I want to control the frequency of PWM accurately.</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/73670/i-want-to-control-the-frequency-of-pwm-accurately</link><description>Hello 
 I&amp;#39;m testing multiple frequencies to ensure smooth ultrasound control. 
 Frequency can be generated via &amp;#39;APP_PWM_DEFAULT_CONFIG_1CH (period, pin)&amp;#39;. But it seems difficult to use this to output more accurate frequencies. 
 For example, if I use</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 08 Apr 2021 07:56:47 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/73670/i-want-to-control-the-frequency-of-pwm-accurately" /><item><title>RE: I want to control the frequency of PWM accurately.</title><link>https://devzone.nordicsemi.com/thread/303658?ContentTypeID=1</link><pubDate>Thu, 08 Apr 2021 07:56:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5d2d8776-e76c-49e5-8a09-68e671c78609</guid><dc:creator>Karl Ylvisaker</dc:creator><description>[quote user="schosdas"]Thank you for your answer.[/quote]
&lt;p&gt;No problem at all, I am happy to help!&amp;nbsp;&lt;/p&gt;
[quote user="schosdas"]I succeeded in outputting the frequency through Prescaler and top_value of pwm_driver.[/quote]
&lt;p&gt;I am glad to hear that you were able to achieve the desired frequency by my suggestion using the PWM driver :)&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Please do not hesitate to open a new ticket if you should encounter any other issues or questions.&lt;br /&gt;&lt;br /&gt;Good luck with your development!&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I want to control the frequency of PWM accurately.</title><link>https://devzone.nordicsemi.com/thread/303615?ContentTypeID=1</link><pubDate>Thu, 08 Apr 2021 00:52:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:897b669d-e2e3-469e-8a1a-65405c7b4f05</guid><dc:creator>schosdas</dc:creator><description>&lt;p&gt;&lt;span&gt;Thank you for your answer.&lt;/span&gt;&lt;br /&gt;&lt;span&gt;I succeeded in outputting the frequency through Prescaler and top_value of pwm_driver.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: I want to control the frequency of PWM accurately.</title><link>https://devzone.nordicsemi.com/thread/303505?ContentTypeID=1</link><pubDate>Wed, 07 Apr 2021 12:37:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ce04ef43-bf71-4c36-b418-5b1374915d03</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;Hello,&lt;br /&gt;&lt;br /&gt;The PWM library only provides micro-second resolution of the output PWM.&lt;br /&gt;&lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fsdk_nrf5_v17.0.2%2Fgroup__app__pwm.html&amp;amp;anchor=ga530dc15dff207529ff582c38d912a0bb"&gt;The APP_PWM_DEFAULT_CONFIG_1CH&lt;/a&gt;&amp;nbsp;takes the period_in_us argument to set the period.&lt;br /&gt;This is why you are seeing a 100 kHz PWM when you provide it 10, and a 111 kHz PWM when you provide it 9.&lt;br /&gt;1/0.00001 = 100 kHz, 1/0.000009 = 111 kHz.&lt;br /&gt;&lt;br /&gt;If you need to control the period more accurately, you will have to use peripheral driver with&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/support-private/support/267479"&gt;the approach I described to you in your other ticket yesterday&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>