<?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>Problems when counting pulses using GPIOTE and TIMER via PPI in the presence of SoftDevice</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/9306/problems-when-counting-pulses-using-gpiote-and-timer-via-ppi-in-the-presence-of-softdevice</link><description>I am trying to implement frequency counting on nRF51822 by counting number of pulses in a given period. I create a PPI channel with a GPIOTE event on rising edge linked to TIMER counting task. The relevant code is as follows: 
 #define USE_WITH_SOFTDEVICE</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 22 Sep 2015 00:04:17 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/9306/problems-when-counting-pulses-using-gpiote-and-timer-via-ppi-in-the-presence-of-softdevice" /><item><title>RE: Problems when counting pulses using GPIOTE and TIMER via PPI in the presence of SoftDevice</title><link>https://devzone.nordicsemi.com/thread/34358?ContentTypeID=1</link><pubDate>Tue, 22 Sep 2015 00:04:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1270ed3d-60fe-4de4-8590-48b9971e1f5e</guid><dc:creator>diode</dc:creator><description>&lt;p&gt;@Ole The code is actually working now after I correct a bug elsewhere.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problems when counting pulses using GPIOTE and TIMER via PPI in the presence of SoftDevice</title><link>https://devzone.nordicsemi.com/thread/34357?ContentTypeID=1</link><pubDate>Mon, 21 Sep 2015 22:51:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d65953c9-969b-42fe-bd33-f10079f16bcc</guid><dc:creator>diode</dc:creator><description>&lt;p&gt;@Ole I change from NRF_TIMER0 to NRF_TIMER1, and the code runs without a hard default. Now I have a ~300kHz square wave between 0V and VCC (2.8V) going to GPIO pin 2 (FC_GPIO defined in the code), and call count_get() in the main function. It always return 0x0000 but it shouldn&amp;#39;t. I set a breakout and check the value of NRF_TIMER1-&amp;gt;CC[0] register. It is indeed 0. I can also see BITMODE, MODE, and PRESCALER registers of NRF_TIMER1 are set to correct values, which means the NRF_TIMER1 is initiated correctly. I am suspecting there may be something wrong with the PPI configuration. I checked the PPI registers after calling   PPI_enable_channel(), and the results are &lt;a href="http://i.imgur.com/uHUK908.png"&gt;here&lt;/a&gt;. Do you know where I get it wrong?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problems when counting pulses using GPIOTE and TIMER via PPI in the presence of SoftDevice</title><link>https://devzone.nordicsemi.com/thread/34356?ContentTypeID=1</link><pubDate>Mon, 21 Sep 2015 14:09:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ede0a824-b90b-449b-a34f-caeae17f4a90</guid><dc:creator>Ole Bauck</dc:creator><description>&lt;p&gt;Timer0 is used by the SoftDevice, accessing it may lead to a hardfault. Switching to timer1 or timer2 should fix the problem. See &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.130.sds.v1.0.0/sd_resource_reqs/hw_block_interrupt_vector.html?cp=2_7_2_0_10_2"&gt;here&lt;/a&gt; for which type of access you have to the resources while the SoftDevice is enabled.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problems when counting pulses using GPIOTE and TIMER via PPI in the presence of SoftDevice</title><link>https://devzone.nordicsemi.com/thread/34355?ContentTypeID=1</link><pubDate>Fri, 18 Sep 2015 01:09:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:edc348dc-8091-484c-aaaf-e49449273c67</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;I use crossworks - mostly because I&amp;#39;m on OSX but even if I was on windows I&amp;#39;d probably still use it because I prefer it, it&amp;#39;s cheaper and it supports most of the other chips I work on as well (as long as they are ARM). Like all IDEs you have to spend time working with it to learn all the ins and outs but it doesn&amp;#39;t try to be too clever and hide all the details from you behind packs and clever plugins. The worst for that is probably TI&amp;#39;s code composer studio which has so many clever bits of script and behind-the-scenes tools it&amp;#39;s just about impossible to figure out what was compiled and linked with what.&lt;/p&gt;
&lt;p&gt;If you have Keil however, use Keil. You just need to take a little development time to sort out issues like the one you mentioned above and give yourself a rock solid debug environment -the time put into it now pays dividends later.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problems when counting pulses using GPIOTE and TIMER via PPI in the presence of SoftDevice</title><link>https://devzone.nordicsemi.com/thread/34354?ContentTypeID=1</link><pubDate>Fri, 18 Sep 2015 00:43:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:919e5ef7-fc7e-4bec-9822-961049bcb43c</guid><dc:creator>diode</dc:creator><description>&lt;p&gt;@RK just curious, what toolchain are you using?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problems when counting pulses using GPIOTE and TIMER via PPI in the presence of SoftDevice</title><link>https://devzone.nordicsemi.com/thread/34353?ContentTypeID=1</link><pubDate>Fri, 18 Sep 2015 00:29:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:708fd5bf-5c88-4fbb-9cb0-b3f510aa4f02</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;nope - I don&amp;#39;t use keil and think it&amp;#39;s basically junk so I can&amp;#39;t really help you. A proper working development environment which debugs reliably is something you really need to work out, it answers 95% of all development problems instantly.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problems when counting pulses using GPIOTE and TIMER via PPI in the presence of SoftDevice</title><link>https://devzone.nordicsemi.com/thread/34352?ContentTypeID=1</link><pubDate>Fri, 18 Sep 2015 00:26:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:94bf3853-8d03-4101-a31f-9c039419f388</guid><dc:creator>diode</dc:creator><description>&lt;p&gt;I may be missing something but I always get &amp;quot;BS \nrf51822../../../main.c\466 *** error 35: undefined line number&amp;quot; and such when setting breakpoints and start debugging in Keil. The &lt;a href="http://www.keil.com/support/man/docs/uv4/uv4_e035.htm"&gt;Keil doc&lt;/a&gt; says error code 35 means the code is unreachable, but I don&amp;#39;t see how it can be unreachable by setting breakpoint to the first line of count_get(). Do you know what may cause such an error.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problems when counting pulses using GPIOTE and TIMER via PPI in the presence of SoftDevice</title><link>https://devzone.nordicsemi.com/thread/34351?ContentTypeID=1</link><pubDate>Fri, 18 Sep 2015 00:10:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9686996d-a4f0-45fd-ae8e-112b9c432b5c</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;wouldn&amp;#39;t be surprised if it hardfaults from an interrupt handler, but should work from main context. Get the debugger out and start single-stepping it to find out which line it crashes on.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problems when counting pulses using GPIOTE and TIMER via PPI in the presence of SoftDevice</title><link>https://devzone.nordicsemi.com/thread/34350?ContentTypeID=1</link><pubDate>Fri, 18 Sep 2015 00:05:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b736794e-9f88-4bdf-b916-8048f8a6bc89</guid><dc:creator>diode</dc:creator><description>&lt;p&gt;I tried both in an interrupt handler and main function. Neither worked.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problems when counting pulses using GPIOTE and TIMER via PPI in the presence of SoftDevice</title><link>https://devzone.nordicsemi.com/thread/34349?ContentTypeID=1</link><pubDate>Thu, 17 Sep 2015 23:55:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dd34aca3-8695-4bb0-a528-2ab9b1239287</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;and where are you calling count_get() from? An interrupt handler?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>