<?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>NRF51822 generate pulse with GPIO</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/23479/nrf51822-generate-pulse-with-gpio</link><description>I am trying to use NRF51822 GPIO to generate a pulse with max width of 0.3us. According to other tickets in the forum and the product spec, NRF51822 should be able to generate a 50% duty PWM with 8MHz, which means a single pulse width with 0.125us. But</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 14 Jul 2017 07:04:33 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/23479/nrf51822-generate-pulse-with-gpio" /><item><title>RE: NRF51822 generate pulse with GPIO</title><link>https://devzone.nordicsemi.com/thread/92228?ContentTypeID=1</link><pubDate>Fri, 14 Jul 2017 07:04:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3452280e-e7bf-4264-a4f5-90921975a212</guid><dc:creator>zn</dc:creator><description>&lt;p&gt;I am also thinking about this. And probably this is the easiest way to do it.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF51822 generate pulse with GPIO</title><link>https://devzone.nordicsemi.com/thread/92226?ContentTypeID=1</link><pubDate>Thu, 13 Jul 2017 20:21:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4d29705b-52b1-4b3f-bc37-6a2a37780eef</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;If you just want one pulse of &amp;lt;.3us I&amp;#39;d just write my own 4 lines (or so) of assembly to do it.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF51822 generate pulse with GPIO</title><link>https://devzone.nordicsemi.com/thread/92227?ContentTypeID=1</link><pubDate>Thu, 13 Jul 2017 13:34:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:79ad4f29-6516-4a0f-8995-ec62fd52db19</guid><dc:creator>zn</dc:creator><description>&lt;p&gt;This makes sense. So the assembly looks like this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;117       	*addrPinClr = PIN_MASK;
000213be:   ldr     r3, [r7, #8]
000213c0:   movs    r2, #128        ; 0x80
000213c2:   lsls    r2, r2, #9
000213c4:   str     r2, [r3, #0]
118       	*addrPinSet = PIN_MASK;
000213c6:   ldr     r3, [r7, #12]
000213c8:   movs    r2, #128        ; 0x80
000213ca:   lsls    r2, r2, #9
000213cc:   str     r2, [r3, #0]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Haven&amp;#39;t got any good idea that how to generate a single pulse with PPI. Any suggestions?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF51822 generate pulse with GPIO</title><link>https://devzone.nordicsemi.com/thread/92224?ContentTypeID=1</link><pubDate>Thu, 13 Jul 2017 12:41:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e484f2b4-efa2-499a-84f0-a5fdb8e439ca</guid><dc:creator>zn</dc:creator><description>&lt;p&gt;Actually I don&amp;#39;t want to generate a PWM, but instead a single pulse with width less than 0.3us. And the example code is only for test what&amp;#39;s the fastest toggling speed.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF51822 generate pulse with GPIO</title><link>https://devzone.nordicsemi.com/thread/92223?ContentTypeID=1</link><pubDate>Thu, 13 Jul 2017 07:52:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5f241fae-44e6-4717-83c0-106ba9b3e55f</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;You need to use GPIOTE and PPI to achieve a 50% duty PWM with 8MHz.&lt;/p&gt;
&lt;p&gt;You can find code example for that in &lt;a href="https://devzone.nordicsemi.com/question/69566/nrf52-clock-in-and-out/?answer=69680#post-id-69680"&gt;this post&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF51822 generate pulse with GPIO</title><link>https://devzone.nordicsemi.com/thread/92225?ContentTypeID=1</link><pubDate>Thu, 13 Jul 2017 03:53:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:96146a52-b789-4bc1-b160-2e7a54575a48</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;If you go look at the assembly code that generates I suspect you&amp;#39;ll find that the loop is about 6 instructions long. 6/16,000,000 = 3.75us. Toggling the pin like that isn&amp;#39;t going to work, you need PPI.&lt;/p&gt;
&lt;p&gt;One line of C != one assembly instruction&lt;/p&gt;
&lt;p&gt;oh and try optimisation, but put&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;uint32_t volatile * addrPinSet .. 
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;to stop the loop getting optimized out (or use the proper CMSIS macros)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>