<?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 do I change PWM port to 1 on example &amp;quot;low_power_pwm&amp;quot;</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/22983/how-do-i-change-pwm-port-to-1-on-example-low_power_pwm</link><description>Hi,
I have Design a new product based on the NRF52840 I am trying to get the lcd up and running so first thing is the pwm for the backlight. I am using pin 1.08 for the pwm. but I seem to have problem trying to convert LED1 to Port 1 I setup the Low_power_pwm</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 12 Oct 2020 07:58:57 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/22983/how-do-i-change-pwm-port-to-1-on-example-low_power_pwm" /><item><title>RE: how do I change PWM port to 1 on example "low_power_pwm"</title><link>https://devzone.nordicsemi.com/thread/274210?ContentTypeID=1</link><pubDate>Mon, 12 Oct 2020 07:58:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bbbe17ce-c0b0-4ec8-bda7-4df3dc2f12b8</guid><dc:creator>Shahar</dc:creator><description>&lt;p&gt;The issue still exists in SDK 17.0.0 and SDK 17.0.2&lt;br /&gt;&lt;br /&gt;Can someone from Nordic please add this to the next SDK releases?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how do I change PWM port to 1 on example "low_power_pwm"</title><link>https://devzone.nordicsemi.com/thread/249788?ContentTypeID=1</link><pubDate>Wed, 13 May 2020 15:11:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e7720b00-dc37-4c8c-bfb9-43a0631735e7</guid><dc:creator>Igor</dc:creator><description>&lt;p&gt;NRF SDK 16.0.0 also has an issue with low power PWM on port 1.&lt;/p&gt;
&lt;p&gt;low_power_pwm.c, line 188 should be changed from&lt;br /&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt; nrf_gpio_cfg_output(pin_number);&lt;/pre&gt;&lt;br /&gt;to&lt;br /&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt; nrf_gpio_cfg_output(NRF_GPIO_PIN_MAP(p_pwm_instance-&amp;gt;p_port==NRF_P1,pin_number));&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Proper usage is then:&lt;br /&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#define LED_1          NRF_GPIO_PIN_MAP(1,14) // port 1, pin 14

low_power_pwm_config_t pwm_config;
pwm_config.active_high = LEDS_ACTIVE_STATE;
pwm_config.bit_mask =PIN_MASK(LED_1);
pwm_config.p_port = PIN_PORT(LED_1);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;P.S. There is another Low Power issue present in SDK 16.0.0&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/29076/low_power_pwm-duty_cycle-seems-buggy"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/29076/low_power_pwm-duty_cycle-seems-buggy&lt;/a&gt;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/29076/low_power_pwm-duty_cycle-seems-buggy"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/29076/low_power_pwm-duty_cycle-seems-buggy&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how do I change PWM port to 1 on example "low_power_pwm"</title><link>https://devzone.nordicsemi.com/thread/90419?ContentTypeID=1</link><pubDate>Mon, 26 Jun 2017 12:31:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:12ff7822-2c10-4b8d-a278-3dda94d7a46d</guid><dc:creator>Herb W.</dc:creator><description>&lt;p&gt;Thank you Kristin,&lt;/p&gt;
&lt;p&gt;I it was the Direction not getting set that I missed.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how do I change PWM port to 1 on example "low_power_pwm"</title><link>https://devzone.nordicsemi.com/thread/90418?ContentTypeID=1</link><pubDate>Thu, 22 Jun 2017 07:56:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1775f20d-ae3b-4a9e-a3ad-9ac29e206983</guid><dc:creator>FormerMember</dc:creator><description>&lt;p&gt;To get the correct  pin numbers for pin  P1.x, you can use ´NRF_GPIO_PIN_MAP()´in nrf_gpio.h.&lt;/p&gt;
&lt;p&gt;For example, pin P1.08:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#define PIN_D7    NRF_GPIO_PIN_MAP(1,8) 
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;By porting P1.8 this way, the value of PIN_D7 is 40 (32+8).&lt;/p&gt;
&lt;p&gt;However, low_power_pwm_init() requires a bit mask, which is a uint32_t. In that case, P1.08 is pin 8 on port 1:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;low_power_pwm_config.bit_mask       = (1 &amp;lt;&amp;lt;  NRF_GPIO_PIN_MAP(0,8)); 
low_power_pwm_config.p_port         = NRF_P1;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In &lt;code&gt;low_power_pwm_init()&lt;/code&gt;, when configuring the output pin(s), the port is not taken care of. Therefore, to make the pwm driver work with port 1 pins, &lt;code&gt;nrf_gpio_port_dir_output_set()&lt;/code&gt; has to be used to configure the pin in  &lt;code&gt;low_power_pwm_init()&lt;/code&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; nrf_gpio_port_dir_output_set(p_pwm_config-&amp;gt;p_port,p_pwm_instance-&amp;gt;bit_mask); //todo
    //while (bit_mask)
    //{
    //    if (bit_mask &amp;amp; 0x1UL)
    //    {
    //        //nrf_gpio_cfg_output(pin_number);
    //    }
    //
    //    pin_number++;
    //    bit_mask &amp;gt;&amp;gt;= 1UL;
    //}
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>