<?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 compare not matching after rewriting CC register</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/118435/timer-compare-not-matching-after-rewriting-cc-register</link><description>Had an interresting issue that we have resolved, but we&amp;#39;re trying to understand... 
 
 We had a timer (TIMER2) running and matching towards CC[3] every 500us. This match results in the ISR being called. In the sISR we updated CC[2] to generate another</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Sun, 04 Jan 2026 11:12:53 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/118435/timer-compare-not-matching-after-rewriting-cc-register" /><item><title>RE: Timer compare not matching after rewriting CC register</title><link>https://devzone.nordicsemi.com/thread/557855?ContentTypeID=1</link><pubDate>Sun, 04 Jan 2026 11:12:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5fbaf3c1-a628-48d3-ae61-617b9a89c149</guid><dc:creator>janvb</dc:creator><description>&lt;p&gt;Happy new year!&amp;nbsp; Wishing you all the best and also some spare time to look into this problem....&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer compare not matching after rewriting CC register</title><link>https://devzone.nordicsemi.com/thread/555842?ContentTypeID=1</link><pubDate>Mon, 01 Dec 2025 10:13:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:345c81fb-a0f1-424c-87d4-32be3aecd894</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Not had a chance to try it yet.&lt;/p&gt;
&lt;p&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer compare not matching after rewriting CC register</title><link>https://devzone.nordicsemi.com/thread/555762?ContentTypeID=1</link><pubDate>Fri, 28 Nov 2025 14:20:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:11e09d6a-feb2-4820-b70d-f1f154bc2881</guid><dc:creator>janvb</dc:creator><description>&lt;p&gt;Any success?&lt;/p&gt;
&lt;p&gt;Jan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer compare not matching after rewriting CC register</title><link>https://devzone.nordicsemi.com/thread/555341?ContentTypeID=1</link><pubDate>Tue, 25 Nov 2025 09:03:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dc5b11c2-e559-475e-ab03-752bcbe7721c</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;But I can try with a newer release later if you are not able to make it work.&lt;/p&gt;
&lt;p&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer compare not matching after rewriting CC register</title><link>https://devzone.nordicsemi.com/thread/555339?ContentTypeID=1</link><pubDate>Tue, 25 Nov 2025 08:54:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7a0d9e61-279f-4e49-aa30-3d1fed169e02</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Not really, you see we need to use the version it was released with:&lt;br /&gt;&lt;a href="https://docs.nordicsemi.com/bundle/sdk_nrf5_v17.1.0/page/index.html"&gt;https://docs.nordicsemi.com/bundle/sdk_nrf5_v17.1.0/page/index.html&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;pre&gt;The following toolchains/devices have been used for testing and verification:
 
 - ARM: MDK-ARM version 5.25   
 - GCC: GCC ARM Embedded 9.2020-q2.major
 - IAR: IAR Workbench 7.80.4
 - SES: SES 5.42a
&lt;/pre&gt;
&lt;p&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer compare not matching after rewriting CC register</title><link>https://devzone.nordicsemi.com/thread/555318?ContentTypeID=1</link><pubDate>Tue, 25 Nov 2025 07:41:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:21bda578-fbf3-474c-b6de-5c80d457f143</guid><dc:creator>janvb</dc:creator><description>&lt;p&gt;&lt;span&gt;Can you try updating SES? Y&lt;/span&gt;ou are using an old version of SES, I am using version V8.24.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer compare not matching after rewriting CC register</title><link>https://devzone.nordicsemi.com/thread/555286?ContentTypeID=1</link><pubDate>Mon, 24 Nov 2025 20:58:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:aa0c43b3-b901-420f-a795-7cd310d12462</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;It&amp;#39;s been a while since I looked at nRF5 SDK, can you fix these for me?&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1764017888314v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer compare not matching after rewriting CC register</title><link>https://devzone.nordicsemi.com/thread/555182?ContentTypeID=1</link><pubDate>Mon, 24 Nov 2025 11:04:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b2cac25d-8bbb-42b2-abd6-3d46bd6854a3</guid><dc:creator>janvb</dc:creator><description>&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/V2.0testnordic.zip"&gt;devzone.nordicsemi.com/.../V2.0testnordic.zip&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer compare not matching after rewriting CC register</title><link>https://devzone.nordicsemi.com/thread/555168?ContentTypeID=1</link><pubDate>Mon, 24 Nov 2025 09:51:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:23fb86d1-35aa-4880-87cd-59620dd6ed88</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;If you don&amp;#39;t want to share it in this public case (drag and drop a zip file here), then I guess you need to make a new private case.&lt;/p&gt;
&lt;p&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer compare not matching after rewriting CC register</title><link>https://devzone.nordicsemi.com/thread/555074?ContentTypeID=1</link><pubDate>Fri, 21 Nov 2025 15:26:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1f1c219f-062e-4e55-8aee-060578fb6b82</guid><dc:creator>janvb</dc:creator><description>&lt;p&gt;OK, I have prepared a simplified project for you.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Please let me know hoe I can share this.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer compare not matching after rewriting CC register</title><link>https://devzone.nordicsemi.com/thread/554721?ContentTypeID=1</link><pubDate>Tue, 18 Nov 2025 21:14:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:28583540-8221-4b2b-afdb-067cf76c02e8</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;If you want us to take a look at this, I need a full simplified project that recreate the issue in specific that can be run on a DK.&lt;/p&gt;
&lt;p&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer compare not matching after rewriting CC register</title><link>https://devzone.nordicsemi.com/thread/554666?ContentTypeID=1</link><pubDate>Tue, 18 Nov 2025 10:10:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:445a0574-6936-4741-9368-94841c72ef8f</guid><dc:creator>janvb</dc:creator><description>&lt;p&gt;Hello Kenneth.&lt;/p&gt;
&lt;p&gt;I am using&amp;nbsp; nRF_SDK_17.1.0&lt;/p&gt;
&lt;p&gt;This is the&amp;nbsp; ppi config:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;static void ppi_init(void) //MOSFET switching and mainteance&lt;br /&gt;{&lt;br /&gt; &lt;br /&gt; uint32_t input_evt_addr;&lt;br /&gt; uint32_t gpiote_task_addr_set;&lt;br /&gt; uint32_t gpiote_task_addr_clr;&lt;br /&gt; uint32_t timer_task_clr;&lt;br /&gt; uint32_t timer_task_cap;&lt;br /&gt; uint32_t timer_evt_addr1;&lt;br /&gt; uint32_t timer_evt_addr2;&lt;br /&gt; uint32_t vmon1_evt_addr;&lt;br /&gt; uint32_t vmon2_evt_addr;&lt;/p&gt;
&lt;p&gt;uint32_t tdia_task_cap0;&lt;br /&gt; uint32_t tdia_task_cap1; &lt;br /&gt; uint32_t tdia_task_clr;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt; // Configure GPIOTE IN event&lt;br /&gt; nrf_drv_ppi_init();&lt;br /&gt; nrf_drv_ppi_channel_alloc(&amp;amp;ppi_channel1);&lt;br /&gt; nrf_drv_ppi_channel_alloc(&amp;amp;ppi_channel2);&lt;br /&gt; nrf_drv_ppi_channel_alloc(&amp;amp;ppi_channel3);&lt;br /&gt; nrf_drv_ppi_channel_alloc(&amp;amp;ppi_channel4);&lt;br /&gt; nrf_drv_ppi_channel_alloc(&amp;amp;ppi_channel5);&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;nrfx_gpiote_in_config_t input_config = &lt;br /&gt; { &lt;br /&gt; .is_watcher = false,&lt;br /&gt; .hi_accuracy = true,&lt;br /&gt; .pull = NRF_GPIO_PIN_NOPULL,&lt;br /&gt; .sense = NRF_GPIOTE_POLARITY_TOGGLE,&lt;br /&gt; .skip_gpio_setup = false &lt;br /&gt; };&lt;br /&gt; nrfx_gpiote_in_init(Pin_ZC, &amp;amp;input_config, gpiote_event_handler);&lt;br /&gt; nrfx_gpiote_in_event_enable(Pin_ZC, true); //zero cross&lt;/p&gt;
&lt;p&gt;nrfx_gpiote_out_config_t out_config = NRFX_GPIOTE_CONFIG_OUT_TASK_HIGH;&lt;br /&gt; nrfx_gpiote_out_init(Pin_DON, &amp;amp;out_config); //MOSFET on&lt;br /&gt; &lt;br /&gt; input_evt_addr = nrfx_gpiote_in_event_addr_get(Pin_ZC);&lt;br /&gt; gpiote_task_addr_set = nrfx_gpiote_set_task_addr_get(Pin_DON);&lt;br /&gt; gpiote_task_addr_clr = nrfx_gpiote_clr_task_addr_get(Pin_DON);&lt;br /&gt; timer_evt_addr1 = nrfx_timer_event_address_get(&amp;amp;m_timer3,NRF_TIMER_EVENT_COMPARE1);&lt;br /&gt; timer_evt_addr2 = nrfx_timer_event_address_get(&amp;amp;m_timer3,NRF_TIMER_EVENT_COMPARE2);&lt;br /&gt; timer_task_clr = nrfx_timer_task_address_get(&amp;amp;m_timer3, NRF_TIMER_TASK_CLEAR);&lt;br /&gt; timer_task_cap = nrfx_timer_task_address_get(&amp;amp;m_timer3, NRF_TIMER_TASK_CAPTURE0);&lt;br /&gt; &lt;br /&gt; &lt;br /&gt; nrfx_ppi_channel_assign(ppi_channel1,input_evt_addr, timer_task_cap);&lt;br /&gt; nrfx_ppi_channel_fork_assign(ppi_channel1, timer_task_clr);&lt;br /&gt; nrfx_ppi_channel_assign(ppi_channel2, timer_evt_addr1, gpiote_task_addr_clr); &lt;br /&gt; nrfx_ppi_channel_assign(ppi_channel3, timer_evt_addr2, gpiote_task_addr_set);&lt;/p&gt;
&lt;p&gt;nrfx_ppi_channel_enable(ppi_channel1); // capture and clear timer on zero cross&lt;br /&gt; nrfx_ppi_channel_enable(ppi_channel2); //MOSFET on (CC1)&lt;br /&gt; nrfx_ppi_channel_enable(ppi_channel3); //MOSFET off (CC2)&lt;/p&gt;
&lt;p&gt;nrfx_gpiote_out_task_enable(Pin_DON);&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer compare not matching after rewriting CC register</title><link>https://devzone.nordicsemi.com/thread/554660?ContentTypeID=1</link><pubDate>Tue, 18 Nov 2025 09:42:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fb262f6b-4b6a-4ad2-8ece-0be66356a08c</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I think you are looking at the wrong place. The times I have seen someone mention &amp;quot;flash before going dark&amp;quot;, the problem occurs at the time the PWM reach the max or min value, at this time the PWM driver will normally stop and switch to steady high or low output as a normal gpio (since it doesn&amp;#39;t make sense to run it as a PWM at this stage). I have seen number of times that there are small errors during this transition in the PWM driver; disable/enable PWM and configure output high/low is done in the wrong order, thereby for a short period causing inverted output. At least that is where I would have started looking.&lt;/p&gt;
&lt;p&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer compare not matching after rewriting CC register</title><link>https://devzone.nordicsemi.com/thread/554533?ContentTypeID=1</link><pubDate>Mon, 17 Nov 2025 13:16:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fd3337d8-65b9-4e02-b0a4-4c764aa45856</guid><dc:creator>janvb</dc:creator><description>&lt;p&gt;Hi&amp;nbsp; Kenneth, I would really appreciate further investigation.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The application involves a trailing edge dimmer. The effect of the bug I described is that the light will show a flash before going dark when being dimmed lower.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer compare not matching after rewriting CC register</title><link>https://devzone.nordicsemi.com/thread/554523?ContentTypeID=1</link><pubDate>Mon, 17 Nov 2025 12:38:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f9ffb2fe-f6e5-4bfc-8870-5d6e4252fb84</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;Maybe my answer came out a bit wrong, there is nothing wrong with developing with the nRF52-series, if it&amp;#39;s critical for your application to resolve your observation I can try to make a case about it internally.&lt;/p&gt;
&lt;p&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer compare not matching after rewriting CC register</title><link>https://devzone.nordicsemi.com/thread/554521?ContentTypeID=1</link><pubDate>Mon, 17 Nov 2025 12:32:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2709575f-5f4a-47ad-b70a-b92641280025</guid><dc:creator>janvb</dc:creator><description>&lt;p&gt;I regret to see that nrf52 support is winding down and that these chips are&amp;nbsp; apparently no longer recommended for new designs although this is nowhere indicated on the Nordic Semiconductor website.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer compare not matching after rewriting CC register</title><link>https://devzone.nordicsemi.com/thread/554458?ContentTypeID=1</link><pubDate>Sun, 16 Nov 2025 18:09:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:be5e88f1-91af-4b3c-9409-bb9784496589</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I will admit this is indeed interesting, and not something I have heard of before. I think we need to be a bit realistic on what we can investigate on a rather old chip. So unless something is failing like the original request, I think we just have to consider this the way it is by design. For new development I would encourage everyone to check out the nRF54L family of devices. Hope that make sense, though it could be this is relevant for the original poster here.&lt;/p&gt;
&lt;p&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer compare not matching after rewriting CC register</title><link>https://devzone.nordicsemi.com/thread/554406?ContentTypeID=1</link><pubDate>Fri, 14 Nov 2025 14:30:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4280241b-132c-4743-9e93-0880e8370070</guid><dc:creator>janvb</dc:creator><description>&lt;p&gt;I have a similar problem with timer 3 of nrf52820.&lt;/p&gt;
&lt;p&gt;I use ppi to clear a pin on CC[2] and to set on CC[3] . The timer is cleared (also through ppi) with a gpiote event on another pin. This event also creates on interrupt, and in the interrupt routine CC[3] is re-written.&amp;nbsp;CC[2] is fixed on value 2.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Everything works fine as long as CC[3] is written with value greater than 128. When a value below 128 is used, the output pins remains low for one timer cycle. It seems that CC[3] is missing a cycle. Next cycle every thing is OK again, even when values lower than 128 are written.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The timer is running on 4MHz clock and the cycle time is 10ms (counter is approx. 40000 when cleared).&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer compare not matching after rewriting CC register</title><link>https://devzone.nordicsemi.com/thread/520513?ContentTypeID=1</link><pubDate>Wed, 29 Jan 2025 08:49:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fdea92f2-5624-45aa-b34d-d343c83c5263</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;Any chance you could setup a small project for me to recreate it here? My first suggestion would be to update&amp;nbsp;&lt;span&gt;NRF_TIMER2-&amp;gt;CC[2]&amp;nbsp;from a static variable, and not rely on reading out the CC[3]. I know in the past there were some issues reading out the CC[] register, but I believed that was the RTC though, and possible nRF51-series.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Kenneth&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer compare not matching after rewriting CC register</title><link>https://devzone.nordicsemi.com/thread/520492?ContentTypeID=1</link><pubDate>Wed, 29 Jan 2025 06:32:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:89c90402-7a49-49fd-8bc5-b09d8ce5decf</guid><dc:creator>Michael</dc:creator><description>&lt;p&gt;By design the CC[2] is written to a value that is approx 100 less than CC[3] and being written to approx 300us before the desired match.&lt;/p&gt;
&lt;p&gt;if we do not rewrite CC[2] at all, then it matches every time (to the value being set), But if setting it like;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;NRF_TIMER2-&amp;gt;CC[2] = NRF_TIMER2-&amp;gt;CC[3] - offset&lt;/p&gt;
&lt;p&gt;In the&amp;nbsp;ISR triggered by CC[3][ then it only happens sporadically.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer compare not matching after rewriting CC register</title><link>https://devzone.nordicsemi.com/thread/520481?ContentTypeID=1</link><pubDate>Tue, 28 Jan 2025 22:41:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:52b67bb2-5725-44a6-8d8c-bde1cdb13427</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Can&amp;#39;t think of any no, could be interesting if you after writing to CC[2] do a timer capture to CC[4] and check if it&amp;#39;s value is below or above CC[2].&lt;/p&gt;
&lt;p&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>