<?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>nRF52832 Timer Enable Disable Fails Assert and Hard Faults</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/32962/nrf52832-timer-enable-disable-fails-assert-and-hard-faults</link><description>I am having an issue where i use a GPIO pin to start and stop a timer based on device state and a GPIOE toggle event. The issue i am seeing is that nrf_drv_timer_enable and nrf_drv_timer_disable randomly fail assert and this is causing a hard fault. I</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 02 Apr 2018 23:03:00 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/32962/nrf52832-timer-enable-disable-fails-assert-and-hard-faults" /><item><title>RE: nRF52832 Timer Enable Disable Fails Assert and Hard Faults</title><link>https://devzone.nordicsemi.com/thread/126548?ContentTypeID=1</link><pubDate>Mon, 02 Apr 2018 23:03:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:16132dd3-b1bd-4a08-b4c2-5cd2a46fe728</guid><dc:creator>AmbystomaLabs</dc:creator><description>&lt;p&gt;So to further explain it, you rely on a pin read to establish what you should do.&amp;nbsp; Depending on the latency maybe that is true, maybe not.&amp;nbsp; At any one time there should be only one IRQ tied to this function and one system event.&lt;/p&gt;
&lt;p&gt;Likely things just get out of sync.&lt;/p&gt;
&lt;p&gt;By moving all the start/stop to ppi.&amp;nbsp; Your software event can focus on something always true which is to tally.&amp;nbsp; You may have to figure out a way to keep the timer from proceeding until you tally.&amp;nbsp; Just in case the pin is just getting hammered repeatedly without time for you to deal with it.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832 Timer Enable Disable Fails Assert and Hard Faults</title><link>https://devzone.nordicsemi.com/thread/126546?ContentTypeID=1</link><pubDate>Mon, 02 Apr 2018 22:42:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:16de9e12-11a6-4880-bd4e-771aba8e9d24</guid><dc:creator>AmbystomaLabs</dc:creator><description>&lt;p&gt;In addition to what I wrote above, this seemed relevant: &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/32566/gpiote-missing-event/125379#125379"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/32566/gpiote-missing-event/125379#125379&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832 Timer Enable Disable Fails Assert and Hard Faults</title><link>https://devzone.nordicsemi.com/thread/126545?ContentTypeID=1</link><pubDate>Mon, 02 Apr 2018 22:41:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:30346d97-639a-4878-8b67-27a240d49ca6</guid><dc:creator>AmbystomaLabs</dc:creator><description>&lt;p&gt;It&amp;#39;s not clear if you are using the gpiote driver or just registering system events with the SD.&lt;/p&gt;
&lt;p&gt;Either way difficulties can arise.&amp;nbsp; During normal operation the BLE stack will lock out the processor for anything related to your code.&amp;nbsp; Just an advertisement can keep you locked out for nearly 1 msec.&amp;nbsp; During this time ISR&amp;#39;s can accumulate and perhaps the original state is there and perhaps not.&amp;nbsp; There are only so many vectors on the NVIC and they need to play games keeping track of the events that need to be serviced.&lt;/p&gt;
&lt;p&gt;Plus a msec here and there will give you a lot of random latency on your event timing.&lt;/p&gt;
&lt;p&gt;You might be better off working it directly with the gpiote driver and using pin events. Since you said you need to do something on assert.&amp;nbsp; It may be unavoidable to do everything in an ISR. However, looking at your code it seems that you just start the timer on assert and then when button is released (or something) you tally the events.&lt;/p&gt;
&lt;p&gt;Better to let the PPI/GPIOTE handle the start/stop of the timer, then you can always use a soft event on timer completion for your process_hits. This way latency doesn&amp;#39;t matter.&amp;nbsp; You can put the timer clear either in the event handler or let the ppi do it via a fork or shorts.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832 Timer Enable Disable Fails Assert and Hard Faults</title><link>https://devzone.nordicsemi.com/thread/126544?ContentTypeID=1</link><pubDate>Mon, 02 Apr 2018 22:33:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:32b7b2b1-1d6a-475d-94f6-0457be123dce</guid><dc:creator>edmcnicholas</dc:creator><description>&lt;p&gt;This does not work if i need a GPIO to execute one event on high and one on low there seems to be a disconnect in the api for this type of behavior.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832 Timer Enable Disable Fails Assert and Hard Faults</title><link>https://devzone.nordicsemi.com/thread/126529?ContentTypeID=1</link><pubDate>Mon, 02 Apr 2018 14:54:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:877d6931-2219-49bc-b996-637b04df468f</guid><dc:creator>edmcnicholas</dc:creator><description>&lt;p&gt;Thank you for the information and i will have to make sure i have channels left .&amp;nbsp; I also need the GPIO event to trigger my processing function.&amp;nbsp; Should i use PPI to control the clock and the interrupt to run the function?&amp;nbsp; Also the gpio is driven by a time controlled circuit so the fastest it goes is 3.3mS.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832 Timer Enable Disable Fails Assert and Hard Faults</title><link>https://devzone.nordicsemi.com/thread/126525?ContentTypeID=1</link><pubDate>Mon, 02 Apr 2018 14:38:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b0a9ad2f-9176-48be-bf5a-31da2424ee73</guid><dc:creator>AmbystomaLabs</dc:creator><description>&lt;p&gt;You don&amp;#39;t say what the min and max of the timer interval is.&amp;nbsp; A common mistake is to exercise the timers in ISR&amp;#39;s which are inherently delayed and sometime lost if you don&amp;#39;t prepare properly for the event in code.&lt;/p&gt;
&lt;p&gt;Since all you do is start and stop a timer based on gpio, you should have all that done in ppi/gpiote instead of pulling it out to an interrrupt.&amp;nbsp; The ppi/gpiote can be configured such that a pin assert drives timer events.&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Just remember the min timer time is 2 pclk&amp;#39;s.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832 Timer Enable Disable Fails Assert and Hard Faults</title><link>https://devzone.nordicsemi.com/thread/126502?ContentTypeID=1</link><pubDate>Mon, 02 Apr 2018 03:20:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8e847d5b-4d38-420f-b813-58dc095ea8df</guid><dc:creator>edmcnicholas</dc:creator><description>&lt;p&gt;i am using sdk 14.2 btw&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>