<?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 set 2 PWM channel with different frequence on 52810</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/51602/how-to-set-2-pwm-channel-with-different-frequence-on-52810</link><description>I&amp;#39;m using 52810 with s112 stack. 
 
 And I need two PWM channel with different frequence. one channel set to 4KHz to cotroller BEEP, the other one set to 15Khz to control motor. 
 
 For now I use APP_Pwm.c set two channel with same frequence. I don&amp;#39;t</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 02 Sep 2019 13:51:46 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/51602/how-to-set-2-pwm-channel-with-different-frequence-on-52810" /><item><title>RE: How to set 2 PWM channel with different frequence on 52810</title><link>https://devzone.nordicsemi.com/thread/207433?ContentTypeID=1</link><pubDate>Mon, 02 Sep 2019 13:51:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:350c87a9-09ee-4324-8100-26f2cfff213e</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I agree with Dmitry.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;You can use the nrfx_pwm library for your 15kHz PWM, and then handle the 4kHz beep using the TIMER, PPI and GPIOTE modules.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The PWM module is the best choice when you want to seamlessly update the PWM duty cycle from a RAM buffer,&amp;nbsp;and allows you to control up to 4 pins from the same controller (the frequency is shared between all 4 pins though).&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The TIMER/PPI/GPIOTE approach requires a little more manual setup, and doesn&amp;#39;t allow you to read updates directly from RAM, but you are able to set the PWM frequency and duty cycle in a more flexible way. In other words I think this is a good option for the BEEP pulse.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards&lt;br /&gt;Torbjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to set 2 PWM channel with different frequence on 52810</title><link>https://devzone.nordicsemi.com/thread/207337?ContentTypeID=1</link><pubDate>Mon, 02 Sep 2019 09:45:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ffad01ad-fad1-4aaa-bc50-513060ae4c6e</guid><dc:creator>Dmitry</dc:creator><description>&lt;p&gt;Yes, 52810 has one hadware PWM generator, plus two timers that can generate PWM through GPIOTE (I don&amp;#39;t count TIMER0 as it&amp;#39;s usually reserved by the stack).&lt;/p&gt;
&lt;p&gt;app_timer uses RTC, so I think both timers are available in your case. But I would recommend to use&amp;nbsp;&lt;span&gt;nrfx_pwm, maybe second timer will come in handy for some other task.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to set 2 PWM channel with different frequence on 52810</title><link>https://devzone.nordicsemi.com/thread/207304?ContentTypeID=1</link><pubDate>Mon, 02 Sep 2019 08:39:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c70f86b0-c02e-4378-9c03-f023e5c5fcf6</guid><dc:creator>BRN</dc:creator><description>&lt;p&gt;Thanks for your reply.&lt;/p&gt;
&lt;p&gt;Seems that 52810 only has one PWM generator. am I right?&lt;/p&gt;
&lt;p&gt;and i have no idea how to check which Timers are free.&lt;/p&gt;
&lt;p&gt;I use the demo project ble_app_uart from SDK and I set a 1ms timer bia below code:&lt;/p&gt;
&lt;p&gt;----------------------------------------------------&lt;/p&gt;
&lt;p&gt;app_timer_create(&amp;amp;m_app_1ms_tmr,APP_TIMER_MODE_REPEATED,app_1ms_timer_handler); //BRN &lt;br /&gt; app_timer_start(m_app_1ms_tmr, APP_TIMER_TICKS(1), NULL);&lt;/p&gt;
&lt;p&gt;-----------------------------------------------------&lt;/p&gt;
&lt;p&gt;So, which timers are free?&lt;/p&gt;
&lt;p&gt;or could you please tell me the stack used which timers.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to set 2 PWM channel with different frequence on 52810</title><link>https://devzone.nordicsemi.com/thread/207092?ContentTypeID=1</link><pubDate>Fri, 30 Aug 2019 10:12:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c657695f-422d-4612-afc9-a52e03652e23</guid><dc:creator>Dmitry</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;you cannot set different frequency for channels within one PWM instance. Either create a second instance (if you have TIMER1 and TIMER2 free), or use nrfx_pwm module for second channel (app_pwm.c is an old way based on timer and&lt;span&gt;&amp;nbsp;&lt;/span&gt;GPIOTE, whereas nrfx_pwm uses hardware PWM&lt;span&gt;&amp;nbsp;&lt;/span&gt;generator).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>