<?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 Driver duty cycle</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/75813/pwm-driver-duty-cycle</link><description>Hi, 
 I&amp;#39;m using PWM driver DEMO5 to change the voltage of IOs.Now I need different voltage ranges. 
 Here is my code: 
 
 The voltage will change when button is pushed,but the voltage is not accurate.Is there a better way? 
 BTW, I need the IO to output</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 04 Jun 2021 09:43:07 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/75813/pwm-driver-duty-cycle" /><item><title>RE: PWM Driver duty cycle</title><link>https://devzone.nordicsemi.com/thread/313589?ContentTypeID=1</link><pubDate>Fri, 04 Jun 2021 09:43:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:26b9f7a4-7ef3-404b-9f9f-1a84076b6c54</guid><dc:creator>Karl Ylvisaker</dc:creator><description>[quote user="ColorPen"]Thank you Karl.[/quote]
&lt;p&gt;No problem at all! :)&amp;nbsp;&lt;/p&gt;
[quote user="ColorPen"]I&amp;#39;ll try to modify my hardware design and firmware.[/quote]
&lt;p&gt;Great! I look forward to hearing if you achieve the desired functionality.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: PWM Driver duty cycle</title><link>https://devzone.nordicsemi.com/thread/313578?ContentTypeID=1</link><pubDate>Fri, 04 Jun 2021 09:05:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:93e14854-f64a-42f0-8c41-2e4249cd525f</guid><dc:creator>Taylor</dc:creator><description>&lt;p&gt;Thank you Karl.&lt;/p&gt;
&lt;p&gt;I&amp;#39;ll try to modify my hardware design and firmware.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: PWM Driver duty cycle</title><link>https://devzone.nordicsemi.com/thread/313485?ContentTypeID=1</link><pubDate>Thu, 03 Jun 2021 15:58:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:81708911-b2fd-4782-8c44-7ea9de737ad7</guid><dc:creator>Karl Ylvisaker</dc:creator><description>[quote user="ColorPen"]Thank for your reply.[/quote]
&lt;p&gt;No problem at all, I am happy to help!&lt;/p&gt;
[quote user="ColorPen"]Should I add second-order RC filter on hardware?[/quote]
&lt;p&gt;There are many good guides on how you can proceed to use a filter to smoothen a PWM waveform into a somewhat continuous voltage level.&lt;br /&gt;Exactly which filter you end up using depends on the needs of your application, but if you just need a smoothened average&amp;nbsp;&lt;a href="https://www.allaboutcircuits.com/technical-articles/low-pass-filter-a-pwm-signal-into-an-analog-voltage/"&gt;you can achieve this with a simple low-pass filter, for instance&lt;/a&gt;.&lt;/p&gt;
[quote user="ColorPen"]&lt;p&gt;My power system&amp;nbsp; is 3.3V, and I need 1.0V or 2.5V to control the driver chip.So, I set the duty cycle as 30%(1.0V avg) and&lt;/p&gt;
&lt;p&gt;75%(2.5V avg). Is that correct?&lt;/p&gt;[/quote]
&lt;p&gt;This looks correct to me, but I would advice you to always try this out and scope the output before applying it to a sensitive sensor/driver chip, to avoid accidentally damaging it, since this is a risk if anything does not go as expected in the code.&lt;/p&gt;
[quote user="ColorPen"]How can I set the IO output low(0V) after I handle my application? 3.3V(avg) is not allowed to happen.[/quote]
&lt;p&gt;Remove the &amp;quot; |&amp;nbsp;&lt;span&gt;NRF_DRV_PWM_PIN_INVERTED&amp;nbsp; &amp;quot; part of the pin configuration, and you should see the polarity revert back to the default (non-inverted).&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: PWM Driver duty cycle</title><link>https://devzone.nordicsemi.com/thread/313331?ContentTypeID=1</link><pubDate>Thu, 03 Jun 2021 09:38:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1b963f9c-36b7-4f89-9666-009501be5710</guid><dc:creator>Taylor</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;Karl,&lt;/p&gt;
&lt;p&gt;Thank for your reply.&lt;/p&gt;
&lt;p&gt;I want to use PWM to control motor driver chip which have a VREF pin to set limit current.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/MS1101D.png" /&gt;&lt;/p&gt;
&lt;p&gt;My power system&amp;nbsp; is 3.3V, and I need 1.0V or 2.5V to control the driver chip.So, I set the duty cycle as 30%(1.0V avg) and&lt;/p&gt;
&lt;p&gt;75%(2.5V avg). Is that correct? Should I add second-order RC filter on hardware?&lt;/p&gt;
[quote userid="87869" url="~/f/nordic-q-a/75813/pwm-driver-duty-cycle/313320#313320"]You are using the&amp;nbsp;NRF_DRV_PWM_PIN_INVERTED option when configuring your PWM pin. &lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.sdk5.v14.2.0%2Fgroup__nrf__drv__pwm.html&amp;amp;anchor=gac9b3208417530b69e5700eba37474a66"&gt;This will inverse its polarity, and set its idle state to high&lt;/a&gt;.[/quote]
&lt;p&gt;How can I set the IO output low(0V) after I handle my application? 3.3V(avg) is not allowed to happen.&lt;/p&gt;
&lt;p&gt;Thanks!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: PWM Driver duty cycle</title><link>https://devzone.nordicsemi.com/thread/313320?ContentTypeID=1</link><pubDate>Thu, 03 Jun 2021 09:14:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b91238fa-9536-4d3c-b810-b525544951f9</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;Hello,&lt;br /&gt;&lt;br /&gt;Thank you for your patience with this.&lt;/p&gt;
[quote user=""]The voltage will change when button is pushed,but the voltage is not&amp;nbsp;accurate.Is there a better way?[/quote]
&lt;p&gt;Could you please elaborate more on what behavior you are currently seeing?&lt;br /&gt;How are you measuring the voltages, and how is it currently behaving? What do you mean when you say that it is not accurate?&lt;br /&gt;The nRF52810 does not have a DAC module, so unfortunately there is no better way to synthesize lower voltages on an output.&lt;br /&gt;&lt;br /&gt;What will you use these modulated voltages levels for? Please keep in mind that PWM only toggles between VDD and GND, so while the average voltage of a PWM waveform can be changed, there is still only VDD and GND present on the pin - so you need to make sure that whatever is on the receiving end is ok with this.&lt;/p&gt;
[quote user=""]BTW, I need the IO to output low after reached a certain voltage value.So I used&amp;nbsp;&amp;nbsp;nrf_drv_pwm_uninit(&amp;amp;m_pwm0), but the IO output high.[/quote]
&lt;p&gt;You are using the&amp;nbsp;NRF_DRV_PWM_PIN_INVERTED option when configuring your PWM pin. &lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.sdk5.v14.2.0%2Fgroup__nrf__drv__pwm.html&amp;amp;anchor=gac9b3208417530b69e5700eba37474a66"&gt;This will inverse its polarity, and set its idle state to high&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>