<?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>nRF9160 PWM</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/46586/nrf9160-pwm</link><description>Hello, 
 I&amp;#39;m trying to test PWM with a simple example, I&amp;#39;ve edited spm via adding 
 KConfig: 
 
 spm.c 
 
 I&amp;#39;m getting the output at the boot as; 
 
 I assume that PWM_0 initialized as Non-Secure successfully. 
 When I try the code, I don&amp;#39;t get any error</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 26 Jan 2021 10:02:58 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/46586/nrf9160-pwm" /><item><title>RE: nRF9160 PWM</title><link>https://devzone.nordicsemi.com/thread/291228?ContentTypeID=1</link><pubDate>Tue, 26 Jan 2021 10:02:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b188c9ef-dca4-4166-a3d4-0f6b90a74809</guid><dc:creator>paul_tanner</dc:creator><description>&lt;p&gt;I did not find a pwm sample in nrfconnect sdk 1.4 so I thought I should try this.&amp;nbsp; I see a reference to pwm.h and wondered where this should be?&lt;/p&gt;
&lt;p&gt;On a related note there is no .overlay so how could it know which pins to use?&lt;/p&gt;
&lt;p&gt;Regards.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160 PWM</title><link>https://devzone.nordicsemi.com/thread/188692?ContentTypeID=1</link><pubDate>Thu, 23 May 2019 07:03:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6da6c1e9-6e9d-4e6f-8115-0deb21d06e0c</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Great to hear!&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Cheers,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160 PWM</title><link>https://devzone.nordicsemi.com/thread/187316?ContentTypeID=1</link><pubDate>Wed, 15 May 2019 14:26:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ec081d71-6956-4cfd-97c7-cda70650168c</guid><dc:creator>Gurkan</dc:creator><description>&lt;p&gt;Thanks Hakon,&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve done the changes on my end,it&amp;#39;s working all good now.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160 PWM</title><link>https://devzone.nordicsemi.com/thread/187149?ContentTypeID=1</link><pubDate>Wed, 15 May 2019 08:08:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:634976cc-3f38-4a4b-98d5-8b56a981ac13</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;The fix for this is upstream, and will be merged in ncs soon:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/zephyrproject-rtos/zephyr/commit/c0a15c8bd6764ce11a61e2cc3d9a0deedc2ec0b6"&gt;https://github.com/zephyrproject-rtos/zephyr/commit/c0a15c8bd6764ce11a61e2cc3d9a0deedc2ec0b6&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;H&amp;aring;kon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160 PWM</title><link>https://devzone.nordicsemi.com/thread/186733?ContentTypeID=1</link><pubDate>Mon, 13 May 2019 13:26:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8b919fca-31d8-4758-b7f9-5a9c52ed7132</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Sorry, I do not have an update on this. You can go directly on the nrfx_pwm driver (bypassing the zephyr shim layer), or see if the other pwm functions work better (pwm_pin_set_nsec)&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160 PWM</title><link>https://devzone.nordicsemi.com/thread/186475?ContentTypeID=1</link><pubDate>Fri, 10 May 2019 17:53:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:920f82cd-28ba-4576-abb9-c86ccb381ffc</guid><dc:creator>Gurkan</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;Is there any timeline about fixing this bug?&lt;/p&gt;
&lt;p&gt;Or any workaround for high frequency signals? I need to run my PWM signal over 10kHz&lt;/p&gt;
&lt;p&gt;Thanks.&lt;/p&gt;
&lt;p&gt;Gurkan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160 PWM</title><link>https://devzone.nordicsemi.com/thread/184211?ContentTypeID=1</link><pubDate>Mon, 29 Apr 2019 07:05:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5cea6e73-520e-4ca9-9dd0-f2364bcb91f0</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Thank you, I wish you the same.&lt;/p&gt;
&lt;p&gt;The bug is reported,&amp;nbsp;so the developers are now aware of the issue.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160 PWM</title><link>https://devzone.nordicsemi.com/thread/184115?ContentTypeID=1</link><pubDate>Fri, 26 Apr 2019 14:30:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ef7efa93-349d-4139-a155-6b694d2839bc</guid><dc:creator>Gurkan</dc:creator><description>&lt;p&gt;Thank you&amp;nbsp;&lt;span&gt;H&amp;aring;kon,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Have a nice day.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Regards,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Gurkan&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160 PWM</title><link>https://devzone.nordicsemi.com/thread/184112?ContentTypeID=1</link><pubDate>Fri, 26 Apr 2019 14:15:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bf8c7e82-c6e5-40c9-80ae-835517cccd9a</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;This is weird. If I input &amp;gt; 1000 on both period and pulse, it behaves &amp;quot;as expected&amp;quot;, however; if I provide pulse=250 and period=500, it goes haywire.&lt;/p&gt;
&lt;p&gt;Pulse is correct-ish, 252 us, while the period is way off at 753 us. I would expect DC of 50%, but get approx. 25%.&lt;/p&gt;
&lt;p&gt;I&amp;#39;ll report it internally.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160 PWM</title><link>https://devzone.nordicsemi.com/thread/184090?ContentTypeID=1</link><pubDate>Fri, 26 Apr 2019 13:06:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:58ee0c1b-e7f2-4e7b-acae-bffa07943f10</guid><dc:creator>Gurkan</dc:creator><description>&lt;p&gt;The result was same with your hex too. You are right that was the cross talk. I&amp;nbsp; haven&amp;#39;t checked the schematics if the P0.2 at P17 is directly connected to the microcontroller. Apperantly P0.2 is controlling a digital switch which is connected to the P17 and led1.&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve switched the output of PWM_0 to another pin and its working well now.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;On my previous message I said I cannot get PWM signal below %50 but it&amp;#39;s reverse actually. I cannot get PWM signal above %50 duty cycle.&lt;pre class="ui-code" data-mode="text"&gt;/**
 * @brief Set the period and pulse width for a single PWM output.
 *
 * @param dev Pointer to the device structure for the driver instance.
 * @param pwm PWM pin.
 * @param period Period (in microseconds) set to the PWM.
 * @param pulse Pulse width (in microseconds) set to the PWM.
 *
 * @retval 0 If successful.
 * @retval Negative errno code if failure.
 */
static inline int pwm_pin_set_usec(struct device *dev, u32_t pwm,
				   u32_t period, u32_t pulse)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;With this function if I put period 250, the period of signal is 500us.&lt;/p&gt;
&lt;p&gt;when the pulse 1, the duty cycle is 1%;&lt;/p&gt;
&lt;p&gt;When the pulse 250, the duty cycle is 50%.&lt;/p&gt;
&lt;p&gt;If I try to put something bigger that 250, I&amp;#39;m getting invalid pulse_cycle error.&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Gurkan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160 PWM</title><link>https://devzone.nordicsemi.com/thread/184001?ContentTypeID=1</link><pubDate>Fri, 26 Apr 2019 09:09:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:47b93008-2b66-4c14-8214-7f2f87d70f46</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;That looks like crosstalk. Are you sure you are scoping the correct pin? If you are using the nRF9160-DK, the LEDs are not routed to the pin lists, so you have to scope from the left side of the LED1.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Did you try the .hex in my .zip to see if that one worked?&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160 PWM</title><link>https://devzone.nordicsemi.com/thread/183888?ContentTypeID=1</link><pubDate>Thu, 25 Apr 2019 15:45:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ffabb795-38cd-4241-b080-76385bbf8a36</guid><dc:creator>Gurkan</dc:creator><description>&lt;p&gt;Hello&amp;nbsp;&lt;span&gt;H&amp;aring;kon,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I&amp;#39;ve tried your sample and I&amp;#39;ve realized that I actually have pwm signal on P0.2 but with a super small peak-peak voltage level. I&amp;#39;m attaching my scope output. After realizing that I&amp;#39;ve tried my first sample and the result is same, pwm signal exist but with a low voltage output.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Do you think it&amp;#39;s a hardware issue?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;My another question is about timings of signal?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;In your example the duty cycle keep going up and between 0-255us. And the period is set to 255us.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="text"&gt;/**
 * @brief Set the period and pulse width for a single PWM output.
 *
 * @param dev Pointer to the device structure for the driver instance.
 * @param pwm PWM pin.
 * @param period Period (in microseconds) set to the PWM.
 * @param pulse Pulse width (in microseconds) set to the PWM.
 *
 * @retval 0 If successful.
 * @retval Negative errno code if failure.
 */
static inline int pwm_pin_set_usec(struct device *dev, u32_t pwm,
				   u32_t period, u32_t pulse)&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;My scope shows the period of signal 500us and duty of signal keep changing between 50% to 100%. How can I get a pwm signal below 50%? If i try to give pulse time, bigger than period, I&amp;#39;m getting an error as &amp;quot;&amp;lt;err&amp;gt; pwm_nrfx: Invalid pulse_cycles 4096, &amp;gt; period_cycles 4080.&amp;quot; as expected.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/4762.scope_5F00_1.png" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160 PWM</title><link>https://devzone.nordicsemi.com/thread/183673?ContentTypeID=1</link><pubDate>Thu, 25 Apr 2019 08:08:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:833da834-b1e5-4b5f-8ddd-d4de32d0b92e</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;I played a bit around with the PWM, and here&amp;#39;s my example:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/support-attachments/beef5d1b77644c448dabff31668f3a47-4edf034709ee40489ee09584688ce01f/pwm.zip"&gt;devzone.nordicsemi.com/.../pwm.zip&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Could you try this one and see if it works?&lt;/p&gt;
&lt;p&gt;The build/zephyr/merged.hex includes spm (secure_boot). Try this .hex first to see if it works at your end as well, prior to building.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160 PWM</title><link>https://devzone.nordicsemi.com/thread/183557?ContentTypeID=1</link><pubDate>Wed, 24 Apr 2019 14:50:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8c2b02cf-11f2-4fa8-ada9-3447417483a2</guid><dc:creator>Gurkan</dc:creator><description>&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;CONFIG_PWM=y
CONFIG_LOG=y
CONFIG_PWM_LOG_LEVEL_DBG=y
# Stacks and heaps
CONFIG_MAIN_STACK_SIZE=4096
CONFIG_HEAP_MEM_POOL_SIZE=1024&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;This is prj.conf file&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160 PWM</title><link>https://devzone.nordicsemi.com/thread/183554?ContentTypeID=1</link><pubDate>Wed, 24 Apr 2019 14:41:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8542943b-005e-4bb2-9a57-62944e08a9b7</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;How does your prj.conf look like?&lt;/p&gt;
&lt;p&gt;Do you have &amp;quot;CONFIG_PWM=y&amp;quot; set?&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>