<?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>PWM signal was reversed.</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/5093/pwm-signal-was-reversed</link><description>I using github code. 
SDK is 7.0.1
SD : S110 7.1.0 
 Channel : 4 ch 
 Period : 20ms 
 Width : 1-2ms ( RC ) 
 Sometimes the width operates at 18-19ms. 
 ex : PWM2 was reversed.
 
 Init code: 
 void _init(void)
{ 
 nrf__config_t _config = _DEFAULT_CONFIG;</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 06 May 2015 13:31:40 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/5093/pwm-signal-was-reversed" /><item><title>RE: PWM signal was reversed.</title><link>https://devzone.nordicsemi.com/thread/17910?ContentTypeID=1</link><pubDate>Wed, 06 May 2015 13:31:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e88a812b-44b1-435f-b271-a9c3b916dadd</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;@plskeggs: I believe by &amp;quot;power down&amp;quot; he wanted to mention SystemON with CPU turn off (_WFE()).&lt;/p&gt;
&lt;p&gt;Do you still have trouble with PWM ? If possible please attach a project that shows the issue, I can try to test it here.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: PWM signal was reversed.</title><link>https://devzone.nordicsemi.com/thread/17909?ContentTypeID=1</link><pubDate>Mon, 04 May 2015 06:50:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3abc5e37-c8c2-42b5-ad05-83a0ff774dd2</guid><dc:creator>plskeggs</dc:creator><description>&lt;p&gt;Hi, Torbjørn,
What do you mean exactly by powerdown?  If I do this: sd_power_mode_set(NRF_POWER_MODE_CONSTLAT);
does this avoid any PWM powerdown issue?  I&amp;#39;m using USE_WITH_SOFTDEVICE = 1 and I have 3 PWM channels.&lt;/p&gt;
&lt;p&gt;Even with this, and with the Feb 5 2015 Github release of nrf_pwm.c, I still sometimes get an inverted waveform (I&amp;#39;m only looking at channel 0 for now).&lt;/p&gt;
&lt;p&gt;I repeat this sequence 10 times a second (with PWM frequency = 488 Hz):&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;set pwm value to 0 (to float one side of an H-bridge) for 5ms&lt;/li&gt;
&lt;li&gt;read two ADC channels&lt;/li&gt;
&lt;li&gt;restore PWM value to previous setting&lt;/li&gt;
&lt;li&gt;do some calculations (quickly)&lt;/li&gt;
&lt;li&gt;set new PWM value&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I&amp;#39;m suspecting there is a problem with your code when it writes to TASKS_OUT to &amp;quot;fix&amp;quot; the polarity of the output.  I think sometimes it gets it wrong, and inverts the waveform by mistake.&lt;/p&gt;
&lt;p&gt;It looks to me like there is a race condition between when the CC[2] is captured and when the TASKS_OUT is written, though I think the safe_margins_present() is supposed to prevent that.  I tried increasing the pwm_cc_margin_by_prescaler[] for my prescaler, but this did not help.&lt;/p&gt;
&lt;p&gt;Any suggestions?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: PWM signal was reversed.</title><link>https://devzone.nordicsemi.com/thread/17908?ContentTypeID=1</link><pubDate>Fri, 06 Feb 2015 15:07:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ba5c1d73-6fbe-42a9-8858-52495bfa9135</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Nimal,
The PWM driver is updated on github, could you please try and let us know the result.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: PWM signal was reversed.</title><link>https://devzone.nordicsemi.com/thread/17907?ContentTypeID=1</link><pubDate>Tue, 03 Feb 2015 16:51:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2d4689ea-ebe7-4d7e-b44c-3942052ef2a3</guid><dc:creator>nimalhuang</dc:creator><description>&lt;p&gt;Hi, Torbjørn,&lt;/p&gt;
&lt;p&gt;Have you update the PWM driver so that fix the power down&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: PWM signal was reversed.</title><link>https://devzone.nordicsemi.com/thread/17906?ContentTypeID=1</link><pubDate>Fri, 30 Jan 2015 09:23:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4f0156f7-57ee-4247-9555-7afd13410933</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;The latest revision of the nRF51x22 has a issue that affects PWM if you use powerdown, and it might be this issue causing the PWM inverting.&lt;/p&gt;
&lt;p&gt;Fortunately a workaround exists, and I will try to update the PWM driver today to implement it.&lt;/p&gt;
&lt;p&gt;Can you confirm if you are using power down, and also what revision of the nRF51x22 you have?&lt;/p&gt;
&lt;p&gt;UPDATE: Sorry for the slow response, I was caught up in other things.
Can you please try the attached file and see if it works better?
&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/2804.nrf_5F00_pwm.c"&gt;nrf_pwm.c&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;It now adds the workaround for the timer issue introduced in revision 3 (and explained in the nRF51x22 PAN).&lt;/p&gt;
&lt;p&gt;If you can confirm that it solves the issue I will also push an update to the repository.&lt;/p&gt;
&lt;p&gt;Regards
Torbjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>