<?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>how to output 409khz fixed-frequency pwm</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/33434/how-to-output-409khz-fixed-frequency-pwm</link><description>I want to drive a device that needs to output a fixed frequency (409khz) to give it the clock frequency. i use nrf52832, sdk15.0.0, 
 How can I use PWM?</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 02 May 2018 10:29:42 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/33434/how-to-output-409khz-fixed-frequency-pwm" /><item><title>RE: how to output 409khz fixed-frequency pwm</title><link>https://devzone.nordicsemi.com/thread/130501?ContentTypeID=1</link><pubDate>Wed, 02 May 2018 10:29:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:28e5b134-130f-4632-aaf4-53284bb22352</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I am terribly sorry for the late reply.&lt;/p&gt;
&lt;p&gt;If you need a steady pulse (PWM) I suggest that you use the PPI. This way, you will not have to wake up the CPU to change the value of the output GPIO.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The problem, as I see it, is that you have to use a timer, which uses the 32MHz. This means that you have a tick rate of 32.5ns, which means that you would need (1 / 409 000) / 32.5e-9 ~= 39.11 tics in order to have 409kHz. If you use 39 ticks, it will give you a frequency of 410.2564kHz. Alternatively, 40 ticks will give you a frequency of 400kHz.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Depending on what accuracy you need on the frequency, 410kHz might work, but it is not possible to get exactly 409kHz.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>