<?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 change PWM frequency</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/31035/how-to-change-pwm-frequency</link><description>Hi, 
 
 [ Environment ] 
 - Application: Lifesaver - Chip Series: nRF52832 - SDK version: SDK14.2.0 - Compiler: Keil V5 
 
 We have to keep changing the pwm frequency. 
 Reinit will cause a delay. 
 Can I change the PWM frequency without reinitializing</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 14 Jul 2020 09:18:00 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/31035/how-to-change-pwm-frequency" /><item><title>RE: How to change PWM frequency</title><link>https://devzone.nordicsemi.com/thread/259850?ContentTypeID=1</link><pubDate>Tue, 14 Jul 2020 09:18:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fbb632ec-9754-47e7-9c6e-b363da294bd0</guid><dc:creator>L.B.</dc:creator><description>&lt;p&gt;Hello, just wanted to add to this post that a sequence of nrf_drv_pwm_uninit() -&amp;gt; nrf_drv_pwm_init() -&amp;gt; nrf_drv_pwm_simple_playback() takes 11.6 us on a target NRF52832 running at 32 MHz, so it shouldn&amp;#39;t affect the hearing of the human ear.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to change PWM frequency</title><link>https://devzone.nordicsemi.com/thread/122532?ContentTypeID=1</link><pubDate>Wed, 28 Feb 2018 14:16:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a5e68eef-6bb2-4860-a243-f171a6ee11dc</guid><dc:creator>Rune Holmgren</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;The PWM hardware is a high-frequency peripheral which can accurately drive a PWM signal even at high frequencies. It&amp;#39;s intended for use-cases where the duty cycle is changing, so you have to uninitialize and reinitialize the hardware to change the frequency. It&amp;#39;s worth noting that the uninitialization and reinitialization of the peripheral is&amp;nbsp;quite fast,&amp;nbsp;so for many applications this is not a problem. For the purposes of playing sound from a piezo the delay from initializing the reinitializing, the PWM module will not matter. The delay is to short to be perceived by a human ear. For your wireless charging application I do not know the specification, so you will have to check this out yourself.&lt;/p&gt;
&lt;p&gt;An alternative to using the PWM module is using a timer and GPIO with PPI channels performing toggle operations at&amp;nbsp;some frequency. The timer can run and after some period it will send an event directly to the GPIO to toggle a&amp;nbsp;pin through a&amp;nbsp;task.&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/1964/pwm-with-a-piezo-buzzer"&gt;In this question&lt;/a&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;you will find an answer by user&amp;nbsp;Steven Wik where he explains how to set this up. The timer is more flexible than the PWM module, so it is often a good alternative. My manipulating&amp;nbsp;&lt;span&gt;&amp;nbsp;NRF_TIMER2-&amp;gt;CC[1] runtime you can get different frequencies without the delay you get using the PWM peripheral.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Rune Holmgren&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to change PWM frequency</title><link>https://devzone.nordicsemi.com/thread/122531?ContentTypeID=1</link><pubDate>Wed, 28 Feb 2018 04:40:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1450041a-b26f-4378-84cc-f401a1d28a9a</guid><dc:creator>yunjoo727</dc:creator><description>&lt;p&gt;Hi,&amp;nbsp;&lt;span&gt;Rune Holmgren&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thanks for your reply.&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;ul&gt;
&lt;li dir="ltr"&gt;&lt;span lang="en"&gt;&lt;span&gt;Yes, we control the PWM frequency, not the duty.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li dir="ltr"&gt;&lt;span lang="en"&gt;&lt;span&gt;Yes, we are using the PWM driver.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li dir="ltr"&gt;&lt;span lang="en"&gt;&lt;span&gt;The PWM signal is used for melody buzzer and wireless charging.&lt;/span&gt;&lt;span&gt;&amp;nbsp; In both cases, frequency control is required.&amp;nbsp;&lt;/span&gt;&lt;span&gt;So we&amp;#39;d&amp;nbsp;like&amp;nbsp;to know how to freely change the frequency of pwm using pwm driver.&lt;/span&gt;&lt;/span&gt;&lt;span lang="en"&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;span lang="en"&gt;&lt;span&gt;Thanks.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span lang="en"&gt;&lt;span&gt;Best regards,&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span lang="en"&gt;&lt;span&gt;Yun-joo&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to change PWM frequency</title><link>https://devzone.nordicsemi.com/thread/122530?ContentTypeID=1</link><pubDate>Tue, 27 Feb 2018 17:11:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:09becd3f-89c8-452b-8886-d7b523b149f0</guid><dc:creator>Rune Holmgren</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I have a few follow up questions to help me understand the challenge:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Are you sure you mean changing the PWM frequency and not the PWM duty cycle? The duty cycle is the more common property to change while the PWM is running.&lt;/li&gt;
&lt;li&gt;Are you using the hardware PWM peripheral? An alternative may be to use a setup using a Timer or RTC with PPI or interrupts to drive a lower frequency PWM signal&lt;/li&gt;
&lt;li&gt;What sort of device is this PWM signal intended to drive?&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Rune Holmgren&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>