<?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>dim led to minimize current consumption</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/22151/dim-led-to-minimize-current-consumption</link><description>Hello, I am using nrf52832 custom board, with SDK 11.0.0 and s132_nrf52_2.0.0 and trying to dim led. It seems the only suggested solution is to use the pwm driver. I was wondering if there are any other simpler solutions? 
 My use case is to set led</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 23 May 2017 08:24:03 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/22151/dim-led-to-minimize-current-consumption" /><item><title>RE: dim led to minimize current consumption</title><link>https://devzone.nordicsemi.com/thread/87066?ContentTypeID=1</link><pubDate>Tue, 23 May 2017 08:24:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7234ca4f-3f5b-4148-a92d-ed794516e78c</guid><dc:creator>endnode</dc:creator><description>&lt;p&gt;My golden rule so far is: if I don&amp;#39;t understand how certain HW peripheral works, then I stick to SDK example (because Nordic guys know much better). I&amp;#39;m not sure if your code is not going too far from SDK without controlling the situation.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: dim led to minimize current consumption</title><link>https://devzone.nordicsemi.com/thread/87065?ContentTypeID=1</link><pubDate>Tue, 23 May 2017 08:22:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dc1fcfc9-edce-46bf-8b55-0a0016d241d9</guid><dc:creator>endnode</dc:creator><description>&lt;p&gt;Sorry, I&amp;#39;m not good in imagining just in my head how bunch of code works and I don&amp;#39;t have time to test your code so I&amp;#39;m not sure what interrupts you really need to make your ode running continuously. In general all interrupt handling might get delayed if there is some higher priority execution blocking it, which might be the case when you use BLE stack (Soft Device) and it needs to do some radio-related processing. These things typically don&amp;#39;t take more than 1-2ms, in extreme cases it can be 5~6ms or even more (if you use PDU extension + high throughput link and &amp;quot;stream&amp;quot; some data through the connection event). But I bet this is not really the problem for you right now so let&amp;#39;s first make your code work in basic scenario (= FW boots and LED starts to dim and brighten with given period) and then you can test advanced use cases.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: dim led to minimize current consumption</title><link>https://devzone.nordicsemi.com/thread/87062?ContentTypeID=1</link><pubDate>Tue, 23 May 2017 08:18:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:47b0be34-2031-4244-88ab-95c458356d4e</guid><dc:creator>endnode</dc:creator><description>&lt;p&gt;Hi Sal, normally in embedded systems you initialize all HW (drivers) first during the boot and then you only run &amp;quot;safe&amp;quot; functions like start/stop. To the RTT tracing: have you ever made it work? If not then it looks like dangerous idea to debug it on custom code which is not known to be stable etc., rather make it work according to tutorials on something stable coming directly from SDK and then carefully port it to your project, step by step.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: dim led to minimize current consumption</title><link>https://devzone.nordicsemi.com/thread/87064?ContentTypeID=1</link><pubDate>Tue, 23 May 2017 03:13:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0aa4f617-fe90-417a-ac35-d3e347433160</guid><dc:creator>Sal</dc:creator><description>&lt;p&gt;Thanks for your help endnode, can you please provide more information about: &amp;quot;unless it blocks MCU for longer time then you can &amp;quot;program&amp;quot; in PWM registers&amp;quot;. How can I check this? Please see the routine I am using above. I am using one instance of the pwm driver. And do not use handler that could block for a longer period. Would high duty cycle affect programming of registers?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: dim led to minimize current consumption</title><link>https://devzone.nordicsemi.com/thread/87061?ContentTypeID=1</link><pubDate>Tue, 23 May 2017 03:05:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:43ad75df-767b-48c2-9bc3-977759004044</guid><dc:creator>Sal</dc:creator><description>&lt;p&gt;I learned my lesson the very hard way unfortunately.&lt;br /&gt;
The issue was due to reinitialization of the driver, that would return 8, then the error check would reset as it is other than success. I have updated my code, would you please let me know if there are better ways of avoiding initilization on every call to the driver. I call the routine few times. How abut the repeats and playback cycles, I am using the lowest possible clock to reduce duty cycle. Please advise here too.&lt;/p&gt;
&lt;p&gt;Also please help with instructions to setup debugging on linux environment using segger RTT. I have added the app_error.h and app_error.c and added the DEBUG symbol on my makefile but I don&amp;#39;t see debug traces when checking the error (after rebuilt it doesn&amp;#39;t reset anymore but also no print of the error value, line number, and file name where the error was triggered). Thanks.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: dim led to minimize current consumption</title><link>https://devzone.nordicsemi.com/thread/87060?ContentTypeID=1</link><pubDate>Thu, 18 May 2017 06:26:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9ea814b9-f0b0-4e83-b5ab-91595d939e27</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;This is why you&amp;#39;re supposed to develop first and then make the board later :)&lt;/p&gt;
&lt;p&gt;There are no issues with PWM if you use Nordic&amp;#39;s driver, so you must just have a bug.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: dim led to minimize current consumption</title><link>https://devzone.nordicsemi.com/thread/87059?ContentTypeID=1</link><pubDate>Thu, 18 May 2017 06:22:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b2a37842-e7f5-4583-8f26-b9ee96b487cf</guid><dc:creator>Sal</dc:creator><description>&lt;p&gt;Hi RK,
Thank you for your comment. Unfortunately I can&amp;#39;t make design changes to the board at this time. I will check the datasheet to see if it is already implemented.
Would you please let me know if there is a software solution or workarounds for the issues I am seeing with pwm?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: dim led to minimize current consumption</title><link>https://devzone.nordicsemi.com/thread/87063?ContentTypeID=1</link><pubDate>Thu, 18 May 2017 06:16:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f815261d-bc7c-4dad-8fbf-e00f1e080283</guid><dc:creator>endnode</dc:creator><description>&lt;p&gt;No, there is no real &amp;quot;simpler&amp;quot; solution then to alter GPIO high and low on the output line towards LED in time faster then your eye can notice so the effective duty cycle (time when line is HIGH divided by total time of one HIGH/LOW period) will determine how much &amp;quot;dim&amp;quot; it will look like. Now PWM is pretty straight forward solution as it should be able to run autonomously (thanks to things specific for nRF52 such as EasyDMA and PPI Tasks&amp;amp;Events) and thus no other activity should impact it (unless it blocks MCU for longer time then you can &amp;quot;program&amp;quot; in PWM registers). Quote from PWM driver documentation on Infocenter:&lt;/p&gt;
&lt;p&gt;Key features include:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Multi-instance support&lt;/li&gt;
&lt;li&gt;Two kinds of playback:
&lt;ul&gt;
&lt;li&gt;Simple: a single sequence of duty cycle values&lt;/li&gt;
&lt;li&gt;Complex: two concatenated sequences&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Sequences are played back a specified number of times&lt;/li&gt;
&lt;li&gt;Optionally, the whole playback can be repeated in a loop&lt;/li&gt;
&lt;li&gt;A user-defined event handler can be used to perform additional actions when a sequence or the whole playback is finished&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;If no event handler is used, playbacks can be carried out without involving the CPU&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: dim led to minimize current consumption</title><link>https://devzone.nordicsemi.com/thread/87058?ContentTypeID=1</link><pubDate>Thu, 18 May 2017 06:08:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bb0991c4-ea8a-4ba3-8118-d987aec1e4e6</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;There&amp;#39;s a simple solution if you are making your own board and want two brightnesses only and have two GPIOs you can use. Hook the LED up to two different GPIOs with two different resistors for two different brighnesses. If both are LOW, the LED is off, if one is HIGH and the other is set to high impedence, you&amp;#39;ll get the LED powered via the one which is high. I guess if you power them both HIGH you&amp;#39;ll get a third really bright brightness.&lt;/p&gt;
&lt;p&gt;No PWM required.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>