<?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>Invert PWM Behaviour</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/33310/invert-pwm-behaviour</link><description>I&amp;#39;m using this PWM output. Now I want to reverse PWM. What should I do? I can&amp;#39;t find the register I need</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 12 Apr 2018 10:56:38 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/33310/invert-pwm-behaviour" /><item><title>RE: Invert PWM Behaviour</title><link>https://devzone.nordicsemi.com/thread/128024?ContentTypeID=1</link><pubDate>Thu, 12 Apr 2018 10:56:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cf966ab5-4333-49a8-bb59-3d16760f44c5</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;If were&amp;nbsp;using the PWM driver, the answer can be found &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/28263/invert-pwm-behaviour"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;But, I see that you are not using the PWM driver, but accessing the PWM peripheral directly. In that case you need to set bit 15 in the buffer you provide in NRF_PWM0-&amp;gt;SEQ[&lt;span&gt;0&lt;/span&gt;].&lt;span&gt;PTR to inverse the polarity.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Snippet:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;int16_t buf[] = {(1 &amp;lt;&amp;lt; 15) | 1500}; // Inverse polarity (bit 15), 1500us duty cycle
NRF_PWM0-&amp;gt;SEQ[0].PTR = (uint32_t)&amp;amp;buf[0];
&lt;/pre&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;See the example &lt;a href="https://github.com/andenore/NordicSnippets/blob/master/examples/pwm/main.c"&gt;here&lt;/a&gt;.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Invert PWM Behaviour</title><link>https://devzone.nordicsemi.com/thread/127938?ContentTypeID=1</link><pubDate>Thu, 12 Apr 2018 06:00:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:31d7dde3-bcde-4c67-83f8-ee73978f3e07</guid><dc:creator>Takeshi Goda</dc:creator><description>&lt;p&gt;I am using this code to generate the PWM&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="fontstyle0"&gt;NRF_PWM0-&amp;gt;PSEL.OUT[0] = (first_pin &amp;lt;&amp;lt; PWM_PSEL_OUT_PIN_Pos) |&lt;br /&gt;(PWM_PSEL_OUT_CONNECT_Connected &amp;lt;&amp;lt;&lt;br /&gt;PWM_PSEL_OUT_CONNECT_Pos);&lt;br /&gt;NRF_PWM0-&amp;gt;ENABLE = (PWM_ENABLE_ENABLE_Enabled &amp;lt;&amp;lt; PWM_ENABLE_ENABLE_Pos);&lt;br /&gt;NRF_PWM0-&amp;gt;MODE = (PWM_MODE_UPDOWN_Up &amp;lt;&amp;lt; PWM_MODE_UPDOWN_Pos);&lt;br /&gt;NRF_PWM0-&amp;gt;PRESCALER = (PWM_PRESCALER_PRESCALER_DIV_1 &amp;lt;&amp;lt;&lt;br /&gt;PWM_PRESCALER_PRESCALER_Pos);&lt;br /&gt;NRF_PWM0-&amp;gt;COUNTERTOP = (16000 &amp;lt;&amp;lt; PWM_COUNTERTOP_COUNTERTOP_Pos); //1 msec&lt;br /&gt;NRF_PWM0-&amp;gt;LOOP = (PWM_LOOP_CNT_Disabled &amp;lt;&amp;lt; PWM_LOOP_CNT_Pos);&lt;br /&gt;NRF_PWM0-&amp;gt;DECODER = (PWM_DECODER_LOAD_Common &amp;lt;&amp;lt; PWM_DECODER_LOAD_Pos) |&lt;br /&gt;(PWM_DECODER_MODE_RefreshCount &amp;lt;&amp;lt; PWM_DECODER_MODE_Pos);&lt;br /&gt;NRF_PWM0-&amp;gt;SEQ[0].PTR = ((uint32_t)(seq0_ram) &amp;lt;&amp;lt; PWM_SEQ_PTR_PTR_Pos);&lt;br /&gt;NRF_PWM0-&amp;gt;SEQ[0].CNT = ((sizeof(seq0_ram) / sizeof(uint16_t)) &amp;lt;&amp;lt;&lt;br /&gt;PWM_SEQ_CNT_CNT_Pos);&lt;br /&gt;NRF_PWM0-&amp;gt;SEQ[0].REFRESH = 0;&lt;br /&gt;NRF_PWM0-&amp;gt;SEQ[0].ENDDELAY = 0;&lt;br /&gt;NRF_PWM0-&amp;gt;TASKS_SEQSTART[0] = 1;&lt;/span&gt; &lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;The first waveform it generates is low level and I need high level&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>