<?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>More than 2 pwm channels per instance</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/11415/more-than-2-pwm-channels-per-instance</link><description>Hi, 
 I am trying to fade out 5 LEDs over the course of 500ms simultaneously. I am using soft device s110 but am happy to pause everything for the half a second while the LEDs fade (ie make the pwm blocking). 
 Is this possible to do? Each of the LEDs</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 29 Jan 2016 09:57:53 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/11415/more-than-2-pwm-channels-per-instance" /><item><title>RE: More than 2 pwm channels per instance</title><link>https://devzone.nordicsemi.com/thread/43052?ContentTypeID=1</link><pubDate>Fri, 29 Jan 2016 09:57:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2c7b092b-08c1-4aea-9fb0-7084482d7ea1</guid><dc:creator>RPDben</dc:creator><description>&lt;p&gt;Thanks Stefan, I will have a poke around now but seems exactly what I need!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: More than 2 pwm channels per instance</title><link>https://devzone.nordicsemi.com/thread/43051?ContentTypeID=1</link><pubDate>Fri, 29 Jan 2016 09:47:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b168e9b5-bc0a-4283-ab5a-38fb70873eb5</guid><dc:creator>Stefan Birnir Sverrisson</dc:creator><description>&lt;p&gt;sorry for pointing you to adding the fifth pwm manually in software. I realize now that there is a library that creates a pwm in software, the low_power_pwm library. I see now there is also &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk51.v10.0.0/low_power_pwm_example.html?cp=4_0_1_4_5_9"&gt;low_power_pwm example&lt;/a&gt; introduced in nRF51 SDK 10.0.0&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: More than 2 pwm channels per instance</title><link>https://devzone.nordicsemi.com/thread/43050?ContentTypeID=1</link><pubDate>Fri, 22 Jan 2016 17:33:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:14ec65ee-6fd3-4a30-9090-5f6de0e5aba8</guid><dc:creator>RPDben</dc:creator><description>&lt;p&gt;Thanks for this advice, I will implement this on Monday and let you know how I get on.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: More than 2 pwm channels per instance</title><link>https://devzone.nordicsemi.com/thread/43049?ContentTypeID=1</link><pubDate>Fri, 22 Jan 2016 15:20:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6bbcffe1-cf04-445a-a4cf-07ecf5468c43</guid><dc:creator>Stefan Birnir Sverrisson</dc:creator><description>&lt;p&gt;Ok, if the softdevice is waiting for BLE commands, then your device is connected with another device, am I correct? When connected, empty payload packets are periodically sent to maintaining the connection. How often that is done depends on the &lt;a href="https://devzone.nordicsemi.com/question/60/what-is-connection-parameters/"&gt;connection interval&lt;/a&gt; you have chosen in your application.&lt;/p&gt;
&lt;p&gt;Anyway, generating a PWM for LED with timer interrupts could work despite softdevice activity, and most likely if you are using S110 8.0.0.  It will surely work without softdevice activity.&lt;/p&gt;
&lt;p&gt;You could implement a PWM with two timers, one is periodic and always sets the pin signal high. The timer also starts a second one-shot timer that will set the pin signal low. For example, you could set the first timer to fire every 10ms. If you want a 50% pwm duty cycle, start the second timer immediately after you have put the pin signal to high, and set the second timer to 5ms.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: More than 2 pwm channels per instance</title><link>https://devzone.nordicsemi.com/thread/43048?ContentTypeID=1</link><pubDate>Fri, 22 Jan 2016 11:59:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4c0591ac-6503-4195-a9e5-a63f7d760d91</guid><dc:creator>RPDben</dc:creator><description>&lt;p&gt;While dimming the LEDs the softdevice is not doing anything other than waiting for Bluetooth commands. This can be paused while the LEDs fade, so effectively the softdevice can be set to do nothing.&lt;/p&gt;
&lt;p&gt;How would I go about using the timers to emulate a PWM?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: More than 2 pwm channels per instance</title><link>https://devzone.nordicsemi.com/thread/43047?ContentTypeID=1</link><pubDate>Thu, 21 Jan 2016 19:28:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8068cb1c-838d-4a7c-b555-adca09082fd3</guid><dc:creator>Stefan Birnir Sverrisson</dc:creator><description>&lt;p&gt;Thank you for your calrification.  With the PWM library, you can create 4xPWMs, as done &lt;a href="https://devzone.nordicsemi.com/question/63809/app_pwm-with-additional-timers/"&gt;here&lt;/a&gt;. There is also a pwm example &lt;a href="https://devzone.nordicsemi.com/question/62942/buzzer-beep-in-immediate-alert-service/"&gt;here with softdevice&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;It is not possible to create more than 4 independent PWMs with hardware, i.e. with TIMER -&amp;gt; PPI -&amp;gt; GPIOTE. There are only 4 GPIOTE channels available so that is the limiting factor. The fifth PWM must be created with with timer interrupts where the CPU toggles the fifth PWM channel.&lt;/p&gt;
&lt;p&gt;My first question is, what is your softdevice schedule when you are dimming the leds? If you have connection interval of 1 second, you could use radio notifications to notify the application when a BLE radio event completes, and start the led dimming then when the CPU is fully available. The CPU is only periodically available during a BLE radio event. The same could be applied if you are advertising with long advertising interval.  When dimming leds, it is probably sufficient to dim the led with 50-100 Hz frequency, where an app_timer is adequate to generate the timer interrupts.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: More than 2 pwm channels per instance</title><link>https://devzone.nordicsemi.com/thread/43043?ContentTypeID=1</link><pubDate>Thu, 21 Jan 2016 15:47:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:228fb7b1-c3da-4eaf-b844-d9ac154d34a6</guid><dc:creator>RPDben</dc:creator><description>&lt;p&gt;Apologies for not making myself clear. The LEDs need to be individually controllable to turn on and of, blink, etc, hence the separate GPIO. However, the fade only needs to happen with all of them at once. So it has to be 5 LEDs fading at the same time from separate GPIO.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: More than 2 pwm channels per instance</title><link>https://devzone.nordicsemi.com/thread/43046?ContentTypeID=1</link><pubDate>Thu, 21 Jan 2016 14:48:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a5c0c29d-9c73-4cf5-bcc6-6ea4d8188cd7</guid><dc:creator>Stefan Birnir Sverrisson</dc:creator><description>&lt;p&gt;I mean if you create a single PWM instance with a single PWM channel, generating PWM on a single GPIO pin. Connect the GPIO pin to all 5 leds in paralell. How much current does one LED consume? the nRF51 drive guide is on &lt;a href="https://devzone.nordicsemi.com/question/22112/nrf51822-gpio-as-open-collector-driver/?answer=22217#post-id-22217"&gt;this thread&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: More than 2 pwm channels per instance</title><link>https://devzone.nordicsemi.com/thread/43045?ContentTypeID=1</link><pubDate>Thu, 21 Jan 2016 14:43:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bc3f3434-06f1-4abf-8045-85e21092568b</guid><dc:creator>RPDben</dc:creator><description>&lt;p&gt;I want to fade them all out at the same time. How would I connect them all to one channel? I can only see the option to connect two GPIOs to one channel?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: More than 2 pwm channels per instance</title><link>https://devzone.nordicsemi.com/thread/43044?ContentTypeID=1</link><pubDate>Thu, 21 Jan 2016 14:35:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f9cbe2de-4c59-4b6a-aeac-97b949ca3b04</guid><dc:creator>Stefan Birnir Sverrisson</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;Do you mean to fade them out identically and simultaneously? If so, you could connect them all to one  PWM channel&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>