<?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>Timer/Counter configuration issues</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/38622/timer-counter-configuration-issues</link><description>Hello, 
 I am having an issue with setting up the event generation timing on the nRF51822. Long story short, I am configuring Timer/Counter 0 to generate an event every 50ms. I am using this to generate an emergency kick-out during data exchange between</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 01 Oct 2018 22:52:15 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/38622/timer-counter-configuration-issues" /><item><title>RE: Timer/Counter configuration issues</title><link>https://devzone.nordicsemi.com/thread/151086?ContentTypeID=1</link><pubDate>Mon, 01 Oct 2018 22:52:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:af70d1a0-db68-48ad-afb1-1d649bd990d8</guid><dc:creator>exgreyfox</dc:creator><description>&lt;p&gt;Whats also puzzling is that upon debugging I can see that I am writing 800,000 dec to CC[1] which is 0xC3500 yet the register only gets 0x03500 which is indicative of TIMER_BIT_WIDTH being set to 16-bits but it is clearly configured to 32-bits.&amp;nbsp;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer/Counter configuration issues</title><link>https://devzone.nordicsemi.com/thread/151085?ContentTypeID=1</link><pubDate>Mon, 01 Oct 2018 22:46:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f228cc0c-1856-47cc-a298-6a628f57e37a</guid><dc:creator>exgreyfox</dc:creator><description>&lt;p&gt;I&amp;#39;m using Keil uVision. Thats likely bc the your directories are set up differently.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Also,&amp;nbsp;&lt;span&gt;NRFX_TIMER_DEFAULT_CONFIG_BIT_WIDTH? I don&amp;#39;t see that #define anywhere in my Project. I have&amp;nbsp;TIMER_DEFAULT_CONFIG_BIT_WIDTH and thats set to 3 in sdk_config.h&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer/Counter configuration issues</title><link>https://devzone.nordicsemi.com/thread/151084?ContentTypeID=1</link><pubDate>Mon, 01 Oct 2018 22:20:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ac4aa44c-6eaa-4710-b034-31faaff36e57</guid><dc:creator>tommy.lane</dc:creator><description>&lt;p&gt;What SDK version are you using?&lt;/p&gt;
&lt;p&gt;my value for&amp;nbsp;NRFX_TIMER_DEFAULT_CONFIG_BIT_WIDTH is 0, which corresponds to 16 bit timer widths.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t know what&amp;nbsp;the problem could be.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/members/joh2"&gt;Jørgen Holmefjord&lt;/a&gt; Do you have any ideas on this?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer/Counter configuration issues</title><link>https://devzone.nordicsemi.com/thread/151083?ContentTypeID=1</link><pubDate>Mon, 01 Oct 2018 22:14:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5ff9de97-f995-4643-a8e0-19e4e5f13929</guid><dc:creator>exgreyfox</dc:creator><description>&lt;p&gt;nrf_drv_timer_config_t timer_cfg = NRF_DRV_TIMER_DEFAULT_CONFIG; already configures the bit width to 32-bits as this is the default configuration but I treid it anyway. Still no dice.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer/Counter configuration issues</title><link>https://devzone.nordicsemi.com/thread/151076?ContentTypeID=1</link><pubDate>Mon, 01 Oct 2018 19:53:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4afd8608-3670-4255-91bf-cd3297b0db7a</guid><dc:creator>tommy.lane</dc:creator><description>&lt;p&gt;nrf_drv_timer_config_t timer_cfg = NRF_DRV_TIMER_DEFAULT_CONFIG;&lt;br /&gt; timer_cfg.bit_width = NRF_TIMER_BIT_WIDTH_32;&lt;/p&gt;
&lt;p&gt;put this in, then try it.&lt;/p&gt;
&lt;p&gt;If the toggle time changes you&amp;#39;ll have to do something similar to what was attempted in the timer handler with the kickout variable.&lt;/p&gt;
&lt;p&gt;I was grabbing at straws which weren&amp;#39;t even there in that last message.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer/Counter configuration issues</title><link>https://devzone.nordicsemi.com/thread/151075?ContentTypeID=1</link><pubDate>Mon, 01 Oct 2018 19:45:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a61af9dc-11fd-4ddd-a199-bf07c2fc10bf</guid><dc:creator>exgreyfox</dc:creator><description>&lt;p&gt;How so? All I am doing is toggling a pin to verify how often the interrupt handler fires. With&amp;nbsp;&amp;nbsp;uint32_t time_ms = 50; //Time(in miliseconds)&amp;nbsp; I should see pulse widths of 50ms not 4ms. Am I missing something? The interrupt handler words, just doesn&amp;#39;t fire at the configured rate.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer/Counter configuration issues</title><link>https://devzone.nordicsemi.com/thread/151074?ContentTypeID=1</link><pubDate>Mon, 01 Oct 2018 19:42:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8321e795-ca26-449a-b37b-1ac687ef4afd</guid><dc:creator>tommy.lane</dc:creator><description>&lt;p&gt;LINE 737 in Main,&lt;/p&gt;
&lt;p&gt;Comment that out, and uncomment the same function inside the if statement, then reset the kickout value to 750, this should fix your problem.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer/Counter configuration issues</title><link>https://devzone.nordicsemi.com/thread/151069?ContentTypeID=1</link><pubDate>Mon, 01 Oct 2018 19:26:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1269eaf8-88b0-49aa-b870-019e86463efb</guid><dc:creator>exgreyfox</dc:creator><description>&lt;p&gt;Here we go:&amp;nbsp;&lt;a href="https://www.dropbox.com/s/5opufjrm3xk9wqh/ble_peripheral_test.rar?dl=0"&gt;www.dropbox.com/.../ble_peripheral_test.rar&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;My implementation will be under \pca10028\s130\arm5_no_packs\ble_app_uart_pca10028_s130.uvprojx&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer/Counter configuration issues</title><link>https://devzone.nordicsemi.com/thread/151068?ContentTypeID=1</link><pubDate>Mon, 01 Oct 2018 19:24:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d3d16f38-b455-44ab-9552-5e7586bfd86c</guid><dc:creator>tommy.lane</dc:creator><description>&lt;p&gt;I just meant your timer setup code, but you could upload it to dropbox and post a link, I guess.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer/Counter configuration issues</title><link>https://devzone.nordicsemi.com/thread/151067?ContentTypeID=1</link><pubDate>Mon, 01 Oct 2018 19:21:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c4220239-edfe-4634-b199-798666d05010</guid><dc:creator>exgreyfox</dc:creator><description>&lt;p&gt;Yes, is there a way I can post my zipped up project folder on this forum?&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer/Counter configuration issues</title><link>https://devzone.nordicsemi.com/thread/151065?ContentTypeID=1</link><pubDate>Mon, 01 Oct 2018 19:02:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:482c8e26-043d-492a-b0da-a89f096e43f4</guid><dc:creator>tommy.lane</dc:creator><description>&lt;p&gt;Could you post your code?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer/Counter configuration issues</title><link>https://devzone.nordicsemi.com/thread/151064?ContentTypeID=1</link><pubDate>Mon, 01 Oct 2018 18:49:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:531f30a3-da29-4303-80a2-406db9a98925</guid><dc:creator>exgreyfox</dc:creator><description>&lt;p&gt;Negative, I have changed the second argument of the extended capture compare to point to CC[1]&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer/Counter configuration issues</title><link>https://devzone.nordicsemi.com/thread/151043?ContentTypeID=1</link><pubDate>Mon, 01 Oct 2018 16:19:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fc9cb3ae-3339-4df6-a909-f2f2a6c81018</guid><dc:creator>tommy.lane</dc:creator><description>&lt;p&gt;Are you still checking CC[0]?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer/Counter configuration issues</title><link>https://devzone.nordicsemi.com/thread/151040?ContentTypeID=1</link><pubDate>Mon, 01 Oct 2018 16:15:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a1c08318-76f7-43ff-b574-4e5d8350b567</guid><dc:creator>exgreyfox</dc:creator><description>&lt;p&gt;Yes, all 0&amp;#39;s are 1&amp;#39;s with Timer 1 enabled in the sdk_config.h file and still seeing the same erroneous result.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer/Counter configuration issues</title><link>https://devzone.nordicsemi.com/thread/151039?ContentTypeID=1</link><pubDate>Mon, 01 Oct 2018 16:13:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a1d3dee8-60cf-4ba9-a75c-003b96345d2f</guid><dc:creator>tommy.lane</dc:creator><description>&lt;p&gt;If you were to change all your code and replace the 0&amp;#39;s with 1&amp;#39;s where channels, timers, and counters are concerned I believe your code would work fine.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Assuming you have channel 1 enabled in the SDK config.h included in your project.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer/Counter configuration issues</title><link>https://devzone.nordicsemi.com/thread/151030?ContentTypeID=1</link><pubDate>Mon, 01 Oct 2018 15:07:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5f4c260f-b675-45ad-b53d-8046b41b5869</guid><dc:creator>exgreyfox</dc:creator><description>&lt;p&gt;I see. At this point, I cant see a path forward with this and it seems to be the same for you guys. I&amp;#39;m not sure if this is a bug in the silicon or a bug in the Nordic HAL driver layer but I have a Timer Counter I am configuring to bang away at 50ms and its doing so at 4ms. All this does is change the constant which dictates how many clock timer/counter interrupt handler firings to count for a while loop bailout that I am using so it should be ok. My only concern is if this discrepancy is indicative of some other more egregious bug.&amp;nbsp;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer/Counter configuration issues</title><link>https://devzone.nordicsemi.com/thread/150873?ContentTypeID=1</link><pubDate>Mon, 01 Oct 2018 04:08:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:457d084d-56f4-4205-b3b5-9f141361c894</guid><dc:creator>tommy.lane</dc:creator><description>&lt;p&gt;I&amp;#39;m not 100% sure on this as I haven&amp;#39;t read every shred of the docs on this topic, however I have used the extended compare in the past. It&amp;#39;s my understanding that the second parameter of the extended compare is the constant which indicates the physical timer channel to monitor for a true compare event.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer/Counter configuration issues</title><link>https://devzone.nordicsemi.com/thread/150553?ContentTypeID=1</link><pubDate>Wed, 26 Sep 2018 19:38:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4b0399f7-5f1b-4207-9152-e55456ddb228</guid><dc:creator>exgreyfox</dc:creator><description>&lt;p&gt;I am using Timer Counter 1 not 0. I was under the impression that the CC[n] register specifies capture compare value and you can have multiple compare registers per a single timer instantiation. In other words, CC[0] has nothing to do with Timer Counter 0. Or am I wrong and I misinterpreted the reference manual?&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer/Counter configuration issues</title><link>https://devzone.nordicsemi.com/thread/150552?ContentTypeID=1</link><pubDate>Wed, 26 Sep 2018 19:29:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4ff30c4a-97aa-4104-9c1b-d6143f09c648</guid><dc:creator>tommy.lane</dc:creator><description>&lt;p&gt;Okay, perhaps the previous comments have been unclear.&lt;/p&gt;
&lt;p&gt;You CAN NOT use timer 0 in any way whatsoever and expect the softdevice (blue tooth) to work.&lt;/p&gt;
&lt;p&gt;you will have to change every single instance of 0 to 1, or something else depending on what other services are running.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer/Counter configuration issues</title><link>https://devzone.nordicsemi.com/thread/150551?ContentTypeID=1</link><pubDate>Wed, 26 Sep 2018 19:25:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5656c56b-6f95-482f-a357-45ba19448322</guid><dc:creator>exgreyfox</dc:creator><description>&lt;p&gt;I am using channel 0&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer/Counter configuration issues</title><link>https://devzone.nordicsemi.com/thread/150526?ContentTypeID=1</link><pubDate>Wed, 26 Sep 2018 15:51:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:66606360-6672-47dc-add1-1d755285ac3e</guid><dc:creator>exgreyfox</dc:creator><description>&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/members/haakonsh"&gt;haakonsh&lt;/a&gt;&amp;nbsp;BITMODE register is set to 32-bits. Are there any other registers you would like me to verify? This is very puzzling, I don&amp;#39;t understand why this isn&amp;#39;t working. All of the configurations look properly set.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer/Counter configuration issues</title><link>https://devzone.nordicsemi.com/thread/150503?ContentTypeID=1</link><pubDate>Wed, 26 Sep 2018 13:48:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b76f61ac-498c-4fc7-b05e-558577555e37</guid><dc:creator>tommy.lane</dc:creator><description>&lt;p&gt;nrf_drv_timer_extended_compare(&amp;amp;TIMER, NRF_TIMER_CC_CHANNEL0, time_ticks, NRF_TIMER_SHORT_COMPARE1_CLEAR_MASK, true);&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;nrf_drv_timer_extended_compare(&amp;amp;TIMER, NRF_TIMER_CC_CHANNELX, time_ticks, NRF_TIMER_SHORT_COMPARE1_CLEAR_MASK, true);&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Change channel to proper channel (replace X with proper timer channel)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer/Counter configuration issues</title><link>https://devzone.nordicsemi.com/thread/150428?ContentTypeID=1</link><pubDate>Wed, 26 Sep 2018 09:22:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bfca1cd9-c51d-4fd9-b942-37a5df894edc</guid><dc:creator>haakonsh</dc:creator><description>&lt;p&gt;Yeah, I think the timer is configured for 16-bit only. What&amp;#39;s the value of the BITMODE register?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer/Counter configuration issues</title><link>https://devzone.nordicsemi.com/thread/150331?ContentTypeID=1</link><pubDate>Tue, 25 Sep 2018 18:58:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6c38cb3b-7a83-420f-922a-adb9828ae396</guid><dc:creator>exgreyfox</dc:creator><description>&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/members/haakonsh"&gt;haakonsh&lt;/a&gt;&amp;nbsp;I just took a look at the value of register CC[0] and as I stepped through the code while debugging, after executing the line&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;nrf_drv_timer_extended_compare(&amp;amp;TIMER, NRF_TIMER_CC_CHANNEL0, time_ticks, NRF_TIMER_SHORT_COMPARE1_CLEAR_MASK, true);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;CC[0] appears to contain the value 0x00003500 which is 13,568 dec. So I guess this is the discrepancy that we are seeing here. I see that time_ticks equates to 800,000 and is being passed as the cc_value argument to be written to register CC[0]. 800,000 dec = 0xC3500 in hex and what is actually making it into CC[0] is 0x3500. Somehow the 0xC0000 is being dropped. I tried simply forcing the value of CC[0] with the following code:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;NRF_TIMER_Type * p_reg;
p_reg-&amp;gt;CC[0] = 0xC3500;
nrf_drv_timer_enable(&amp;amp;TIMER); &lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;But I end up in the Hard fault Handler.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Any ideas?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer/Counter configuration issues</title><link>https://devzone.nordicsemi.com/thread/149865?ContentTypeID=1</link><pubDate>Fri, 21 Sep 2018 14:21:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bd252df4-7c3d-4eec-ac95-9f2d261dbad1</guid><dc:creator>exgreyfox</dc:creator><description>&lt;p&gt;Yes I am using SoftDevice. I have made sure to switch to Timer 1 per your earlier instructions. I will get the value of CC[0] and get back to you.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>