<?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>Unintended pulse at start up of a PWM output</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/122697/unintended-pulse-at-start-up-of-a-pwm-output</link><description>Hello, 
 On nRF52832, I implemented a code with PWM output at P0.07. 
 Here is the section at my overlay: 
 
 pwmleds { 
 compatible = &amp;quot;pwm-leds&amp;quot; ; 
 pwm_led0: pwm_led_0 { 
 pwms = &amp;lt; &amp;amp; pwm0 0 PWM_MSEC ( 0 ) PWM_POLARITY_NORMAL &amp;gt;; 
 }; 
 }; 
 
 
 &amp;amp; pwm0</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 08 Jul 2025 03:53:28 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/122697/unintended-pulse-at-start-up-of-a-pwm-output" /><item><title>RE: Unintended pulse at start up of a PWM output</title><link>https://devzone.nordicsemi.com/thread/541705?ContentTypeID=1</link><pubDate>Tue, 08 Jul 2025 03:53:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:531700ac-41c7-42c7-ab0d-52a90db259ee</guid><dc:creator>keithauhk</dc:creator><description>&lt;p&gt;Hi Benjamin,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks! I just able to solve the issue.&lt;br /&gt;It is caused by the &amp;quot;&lt;span&gt;nordic,invert&lt;/span&gt;&lt;span&gt;;&amp;quot; line in overlay.&lt;br /&gt;As I am using&amp;nbsp;PWM_POLARITY_NORMAL, that line should not be added.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unintended pulse at start up of a PWM output</title><link>https://devzone.nordicsemi.com/thread/541648?ContentTypeID=1</link><pubDate>Mon, 07 Jul 2025 14:04:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e77974f9-934f-4767-8321-73102eeaed46</guid><dc:creator>Benjamin</dc:creator><description>&lt;p&gt;Hi again Keith,&lt;/p&gt;
&lt;p&gt;The LED pins have pull-up resistors, so after a reset you will see a high pulse regardless of whether the PWM polarity is set to normal or inverted. This happens because, during the initial startup phase, the PWM signal has not started yet.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unintended pulse at start up of a PWM output</title><link>https://devzone.nordicsemi.com/thread/541434?ContentTypeID=1</link><pubDate>Fri, 04 Jul 2025 09:57:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d4d52656-c3b8-4dcb-83fe-9bfee30d3666</guid><dc:creator>keithauhk</dc:creator><description>&lt;p&gt;Hello Benjamin,&lt;/p&gt;
&lt;p&gt;1. I thought this is the a way that I can get the PWM output pin as low level after power on. I am fine with any settings in the overlay as I can just change the output frequency by using&amp;nbsp;pwm_set_dt() in my codes.&lt;br /&gt;&lt;br /&gt;BTW, I just changed this period value as&amp;nbsp;PWM_MSEC(20) in the overlay file. In this case I find a much longer pulse high level pulse after power on while running the pwm example. I tried to comment the do while loop in the example code, so it becomes:&lt;br /&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;int main(void)
{
	const struct device *led_pwm;
	uint8_t led;

	led_pwm = DEVICE_DT_GET(LED_PWM_NODE_ID);
	if (!device_is_ready(led_pwm)) {
		LOG_ERR(&amp;quot;Device %s is not ready&amp;quot;, led_pwm-&amp;gt;name);
		return 0;
	}

	if (!num_leds) {
		LOG_ERR(&amp;quot;No LEDs found for %s&amp;quot;, led_pwm-&amp;gt;name);
		return 0;
	}

	// do {
	// 	for (led = 0; led &amp;lt; num_leds; led++) {
	// 		run_led_test(led_pwm, led);
	// 	}
	// } while (true);
	return 0;
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;In this case, the voltage level appears to be kept as high. Is this an expected behavior even with the setting of PWM_POLARITY_NORMAL?&lt;/p&gt;
&lt;p&gt;2. Please find a capture of the pulse.&lt;br /&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pulse.jpg" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unintended pulse at start up of a PWM output</title><link>https://devzone.nordicsemi.com/thread/541421?ContentTypeID=1</link><pubDate>Fri, 04 Jul 2025 09:18:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fc54f8ed-a393-4846-9260-f0eb2844d594</guid><dc:creator>Benjamin</dc:creator><description>&lt;p&gt;Alright, I have tested with the setup you described and I cannot immediately reproduce the issue. &lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;1. What are you trying to achieve when setting PWM period to 0 in the overlay file?&lt;/p&gt;
&lt;p&gt;2. Could you zoom in on the pulse on the capture?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unintended pulse at start up of a PWM output</title><link>https://devzone.nordicsemi.com/thread/541406?ContentTypeID=1</link><pubDate>Fri, 04 Jul 2025 07:22:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e17b8eb9-2802-43a7-830d-4e5c401d8044</guid><dc:creator>keithauhk</dc:creator><description>&lt;p&gt;Hello Benjamin,&lt;/p&gt;
&lt;p&gt;Yes, this is the sample code that I tested.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unintended pulse at start up of a PWM output</title><link>https://devzone.nordicsemi.com/thread/541405?ContentTypeID=1</link><pubDate>Fri, 04 Jul 2025 07:19:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3bb66c70-c785-46f8-bbc3-6b4b3a567e94</guid><dc:creator>Benjamin</dc:creator><description>&lt;p&gt;Thank you! Just to confirm, is this the code sample that you are using? &lt;code&gt;zephyr/samples/drivers/led/pwm/&lt;/code&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unintended pulse at start up of a PWM output</title><link>https://devzone.nordicsemi.com/thread/541392?ContentTypeID=1</link><pubDate>Fri, 04 Jul 2025 02:06:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:aa412f59-1dcf-4eaf-a98a-69d1acbbc24a</guid><dc:creator>keithauhk</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;Attached please find the capture of the waveform. A pulse is observed at ~1s.&lt;br /&gt;The waveform was measured at nRF52dk PCA10040, P0.17, i.e. control of LED1. This confirms the issue is not related to P0.07.&lt;br /&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/PWM_5F00_p007_5F00_pulse.jpg" /&gt;&lt;/p&gt;
&lt;p&gt;The waveform is captured by running the pwm example code, with the following added in DT overlay. No modification was done in the example code.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;/ {
	zephyr,user {
		io-channels = &amp;lt;&amp;amp;adc 0&amp;gt;;
	};
    pwmleds {
		compatible = &amp;quot;pwm-leds&amp;quot;;
		pwm_led0: pwm_led_0 {
			pwms = &amp;lt;&amp;amp;pwm0 0 PWM_MSEC(0) PWM_POLARITY_NORMAL &amp;gt;;
		};
	};
};&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unintended pulse at start up of a PWM output</title><link>https://devzone.nordicsemi.com/thread/541348?ContentTypeID=1</link><pubDate>Thu, 03 Jul 2025 14:35:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5781d875-0b68-42aa-a472-709e3a8e3b7a</guid><dc:creator>Benjamin</dc:creator><description>&lt;p&gt;Hi Keith,&lt;br /&gt;&lt;br /&gt;Do you have a logic analyze trace of this?&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Benjamin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>