<?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>Precise angle control of Servo motor using PWM</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/77884/precise-angle-control-of-servo-motor-using-pwm</link><description>I have included PWM library in BLE uart example to control the servo motor. I am able to import the library successfully and able to control the servo. Below is my init_pwm function 
 
 Total period for a PWM to control a servo motor should be 20ms. This</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 29 Jul 2021 08:03:49 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/77884/precise-angle-control-of-servo-motor-using-pwm" /><item><title>RE: Precise angle control of Servo motor using PWM</title><link>https://devzone.nordicsemi.com/thread/322376?ContentTypeID=1</link><pubDate>Thu, 29 Jul 2021 08:03:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:93b5189a-0d8f-4b1d-8496-d632bc2c60bd</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Good to hear you figured it out. I will consider the case resolved then &lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f642.svg" title="Slight smile"&gt;&amp;#x1f642;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Precise angle control of Servo motor using PWM</title><link>https://devzone.nordicsemi.com/thread/322128?ContentTypeID=1</link><pubDate>Wed, 28 Jul 2021 04:55:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:62141cc9-23dc-45c5-b534-092d9d19d728</guid><dc:creator>Salman</dc:creator><description>&lt;p&gt;I figured it out&amp;nbsp;nrfx_pwm_stop(&amp;amp;m_pwm0, true); will make it stop and when every I want to move the servo I can just use the&amp;nbsp;pwm_update_duty_cycles and it will work.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Precise angle control of Servo motor using PWM</title><link>https://devzone.nordicsemi.com/thread/322127?ContentTypeID=1</link><pubDate>Wed, 28 Jul 2021 04:42:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bcff5210-df06-45f9-a428-89b6f9088594</guid><dc:creator>Salman</dc:creator><description>&lt;p&gt;How can I enable and disable the PWM instance? I only want to enable it when I want to use it. It was possible using PWM library is it possible using PWM driver?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Precise angle control of Servo motor using PWM</title><link>https://devzone.nordicsemi.com/thread/322125?ContentTypeID=1</link><pubDate>Wed, 28 Jul 2021 04:27:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5cca9eca-c8fe-44e3-a58c-81cfdabcc67e</guid><dc:creator>Salman</dc:creator><description>&lt;p&gt;I figured it out I have to enable the PWM legacy layer in the sdk_config as well&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1627446439699v1.png" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Precise angle control of Servo motor using PWM</title><link>https://devzone.nordicsemi.com/thread/322115?ContentTypeID=1</link><pubDate>Tue, 27 Jul 2021 21:09:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3a13d52d-1f7e-4358-8208-22efe9e0939b</guid><dc:creator>Salman</dc:creator><description>&lt;p&gt;Thanks for the code. With some modification the example you have given is working. However when I am trying to implement it in &amp;quot;ble_app_uart&amp;quot; example I am getting the following error.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;..\..\..\main.c(96): error:&amp;nbsp; #20: identifier &amp;quot;NRFX_PWM0_INST_IDX&amp;quot; is undefined&lt;/p&gt;
&lt;p&gt;I have enabled the following in the sdk_config.h&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1627419987443v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1627420012491v2.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;here&amp;nbsp;NRFX_PWM0_INST_IDX is disabled, however I have enabled it in the sdk_config.h (as shown in the picture above.)&lt;/p&gt;
&lt;p&gt;I am unable to figure out what is the problem.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Precise angle control of Servo motor using PWM</title><link>https://devzone.nordicsemi.com/thread/321857?ContentTypeID=1</link><pubDate>Mon, 26 Jul 2021 13:51:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5b355136-bccc-4d44-9e53-29569125d614</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;I wouldn&amp;#39;t recommend using the app_pwm driver unless you are targetting the nRF51 series. The nRF51 lacked a proper PWM controller, and the app_pwm library was developed to mitigate this.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;On the nRF52 series I recommend using the nrf_drv_pwm driver instead, which uses the PWM module in the device rather than relying on timers.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I made a small example some while back showing how to use the nrf_drv_pwm driver to set 4 outputs in a loop:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/6644.pwm_5F00_driver_5F00_simple.zip"&gt;devzone.nordicsemi.com/.../6644.pwm_5F00_driver_5F00_simple.zip&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The resolution of the PWM&amp;nbsp;in your case depends primarily on the clock speed, which is set to 1MHz in the example but can be configured up to 16MHz if needed.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If you keep the frequency at 1MHz and set the countertop value to 20000 you should have a total PWM interval of 20ms, and a total of 1000 values to choose from when adjusting the PWM length between 1ms and 2ms.&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></channel></rss>