<?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/28263/invert-pwm-behaviour</link><description>Is there any way to invert the PWM behaviour easily? I&amp;#39;m trying to develop firmware that will run on the DK52 (LED active high) and my custom board (LED active low). 
 I&amp;#39;m using the nrf_drv_pwm library and have tried to simply change the .output_pins</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 12 Dec 2017 15:48:37 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/28263/invert-pwm-behaviour" /><item><title>RE: Invert PWM Behaviour</title><link>https://devzone.nordicsemi.com/thread/111637?ContentTypeID=1</link><pubDate>Tue, 12 Dec 2017 15:48:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:572361e8-6e46-4b90-81c0-b347c1d63bde</guid><dc:creator>phipi</dc:creator><description>&lt;p&gt;Fantastic, thanks!&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/111636?ContentTypeID=1</link><pubDate>Tue, 12 Dec 2017 15:42:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0b9fcec2-cd40-41a7-ae3d-f80d2893b9d3</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;The the most significant bit[15] in the sequence duty cycle values sets the polarity. See &lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v14.2.0/structnrf__pwm__sequence__t.html?cp=4_0_0_6_9_15_0_4_3#ad3244198df7ea3a206740dacd398db1e"&gt;this&lt;/a&gt; and &lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.nrf52832.ps.v1.1/pwm.html?cp=2_1_0_46_1#concept_wxj_hnw_nr"&gt;this&lt;/a&gt; link.&lt;/p&gt;
&lt;p&gt;So if you want seq_value 0 to correspond to 0 V, you need to set bit 15 to 1. E.g. by using bitwise OR.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;seq_values-&amp;gt;channel_0 = duty_cycle | 0x8000;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;NRF_DRV_PWM_PIN_INVERTED only determines the idle state polarity, the 15th bit in the sequence value determines the polarity when playing the sequence&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/111635?ContentTypeID=1</link><pubDate>Tue, 12 Dec 2017 15:32:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:37685446-7fa7-4ed8-9a84-a5696c03c8f1</guid><dc:creator>phipi</dc:creator><description>&lt;p&gt;I&amp;#39;m using the hardware driver (nrf_drv_pwm)&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/111634?ContentTypeID=1</link><pubDate>Tue, 12 Dec 2017 11:33:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1e678a15-2bed-4f7d-bc1f-552d9a6df265</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Are you using the PWM library(implemented using GPIOTE,TIMER and PPI) or the PWM driver(dedicated PWM hardware) ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>