<?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>error: DWT implements no cycle counter. Cannot be used for cycle counting.</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/75041/error-dwt-implements-no-cycle-counter-cannot-be-used-for-cycle-counting</link><description>Hello, I tried to implement the zephyr executing time functions API on my nrf52 hardware and I got the above error. According to my SoC documentation (nRF52833), this hardware does include a DWT counter. I am not sure if I need to do anything special</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 17 Dec 2021 19:40:48 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/75041/error-dwt-implements-no-cycle-counter-cannot-be-used-for-cycle-counting" /><item><title>RE: error: DWT implements no cycle counter. Cannot be used for cycle counting.</title><link>https://devzone.nordicsemi.com/thread/344209?ContentTypeID=1</link><pubDate>Fri, 17 Dec 2021 19:40:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:30330a93-06c6-4d91-800f-47ce5ef6a5a5</guid><dc:creator>moose</dc:creator><description>&lt;p&gt;I have updated my zephyr base to the latest version in main and I can confirm that the timing function works now. Thanks for your support.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: error: DWT implements no cycle counter. Cannot be used for cycle counting.</title><link>https://devzone.nordicsemi.com/thread/342921?ContentTypeID=1</link><pubDate>Fri, 10 Dec 2021 13:12:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2afc2872-4978-4a20-b300-01a46bfc9957</guid><dc:creator>davege</dc:creator><description>&lt;p&gt;This is perfect!&lt;br /&gt;Thanks &lt;a href="https://devzone.nordicsemi.com/members/sigurdon"&gt;Sigurd&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: error: DWT implements no cycle counter. Cannot be used for cycle counting.</title><link>https://devzone.nordicsemi.com/thread/342919?ContentTypeID=1</link><pubDate>Fri, 10 Dec 2021 13:07:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4e7f4787-d8d9-448a-b999-1c461df5ae99</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;PR was merged now.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: error: DWT implements no cycle counter. Cannot be used for cycle counting.</title><link>https://devzone.nordicsemi.com/thread/342877?ContentTypeID=1</link><pubDate>Fri, 10 Dec 2021 10:18:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:46ba9375-85c0-4fb0-aa3e-8b438a6e6e3f</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/members/davege"&gt;davege&lt;/a&gt;,&lt;/p&gt;
&lt;p&gt;Sorry for the delay.&lt;/p&gt;
&lt;p&gt;We have now opened a PR in upstream Zephyr.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/zephyrproject-rtos/zephyr/pull/41057"&gt;https://github.com/zephyrproject-rtos/zephyr/pull/41057&lt;/a&gt;&lt;/p&gt;
[quote userid="90495" url="~/f/nordic-q-a/75041/error-dwt-implements-no-cycle-counter-cannot-be-used-for-cycle-counting/342718#342718"]do you know if this fix will be included in the next Zephyr version?[/quote]
&lt;p&gt;Next Zephyr release is v3.0, planned for February next year, so the PR should most likely have been merged before that.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/zephyrproject-rtos/zephyr/wiki/Program-Management#actual-and-planned-milestone-dates"&gt;https://github.com/zephyrproject-rtos/zephyr/wiki/Program-Management#actual-and-planned-milestone-dates&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: error: DWT implements no cycle counter. Cannot be used for cycle counting.</title><link>https://devzone.nordicsemi.com/thread/342718?ContentTypeID=1</link><pubDate>Thu, 09 Dec 2021 12:52:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7cbb2ab8-beed-4a3e-87d8-34895ee23046</guid><dc:creator>davege</dc:creator><description>&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/members/sigurdon"&gt;Sigurd&lt;/a&gt; do you know if this fix will be included in the next Zephyr version?&lt;/p&gt;
&lt;p&gt;Any update would be welcome.&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;
&lt;p&gt;D&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: error: DWT implements no cycle counter. Cannot be used for cycle counting.</title><link>https://devzone.nordicsemi.com/thread/325174?ContentTypeID=1</link><pubDate>Mon, 16 Aug 2021 15:26:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fe4348de-b161-44d0-9e72-b9e1589cfc09</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Sure, I can post a link to the github PR here when it&amp;#39;s created.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: error: DWT implements no cycle counter. Cannot be used for cycle counting.</title><link>https://devzone.nordicsemi.com/thread/325173?ContentTypeID=1</link><pubDate>Mon, 16 Aug 2021 15:23:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6f89bcbb-4498-46f7-b6bd-27c9b095320a</guid><dc:creator>davege</dc:creator><description>&lt;p&gt;Thanks for the follow up Sigurd.&lt;/p&gt;
&lt;p&gt;Good to know it is just a minor bug in the code.&lt;/p&gt;
&lt;p&gt;Could you keep us posted here on the resolution from the developers?&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;
&lt;p&gt;D&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: error: DWT implements no cycle counter. Cannot be used for cycle counting.</title><link>https://devzone.nordicsemi.com/thread/325169?ContentTypeID=1</link><pubDate>Mon, 16 Aug 2021 15:05:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9a3b6175-c633-44b1-8172-cefbaae3d290</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;There was a bug in earlier NCS versions that made this ASSERT to be ignored(warning about this was printed in the build log).&lt;/p&gt;
&lt;p&gt;It&amp;#39;s now asserting in NCS v1.6.x.&lt;/p&gt;
&lt;p&gt;It&amp;nbsp;looks to be bug in Zephyr, and I have reported it to the developer.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;In the code we have:&lt;/span&gt;&lt;br /&gt; &lt;span&gt;__ASSERT((DWT-&amp;gt;CTRL &amp;amp; DWT_CTRL_NOCYCCNT_Msk) != 0,&lt;/span&gt;&lt;br /&gt; &lt;br /&gt; &lt;span&gt;It should be&amp;nbsp;&lt;/span&gt;&lt;br /&gt; &lt;span&gt;__ASSERT((DWT-&amp;gt;CTRL &amp;amp; DWT_CTRL_NOCYCCNT_Msk) == 0,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;From&amp;nbsp;ARMv7-M Architecture Reference Manual:&lt;/em&gt;&lt;br /&gt;&lt;em&gt;NOCYCCNT, bit[25] Shows whether the implementation supports a cycle counter:&lt;/em&gt;&lt;br /&gt;&lt;em&gt;0 Cycle counter supported.&lt;/em&gt;&lt;br /&gt;&lt;em&gt;1 Cycle counter not supported&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;&lt;em&gt;From&amp;nbsp;ARMv8-M Architecture Reference Manual:&lt;/em&gt;&lt;br /&gt;&lt;em&gt;NOCYCCNT, bit [25]&lt;/em&gt;&lt;br /&gt;&lt;em&gt;No cycle count. Indicates whether the implementation does not include a cycle counter.&lt;/em&gt;&lt;br /&gt;&lt;em&gt;The possible values of this bit are:&lt;/em&gt;&lt;br /&gt;&lt;em&gt;0 Cycle counter implemented.&lt;/em&gt;&lt;br /&gt;&lt;em&gt;1 Cycle counter not implemented.&lt;/em&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: error: DWT implements no cycle counter. Cannot be used for cycle counting.</title><link>https://devzone.nordicsemi.com/thread/322116?ContentTypeID=1</link><pubDate>Tue, 27 Jul 2021 21:30:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8f3139c9-2281-41f3-89c1-e0237b0dfa67</guid><dc:creator>moose</dc:creator><description>&lt;p&gt;Any update on this? I am still experiencing the same issue. Thx!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: error: DWT implements no cycle counter. Cannot be used for cycle counting.</title><link>https://devzone.nordicsemi.com/thread/321878?ContentTypeID=1</link><pubDate>Mon, 26 Jul 2021 15:05:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9be1707f-445d-4ebe-9562-f2d81e9d34ee</guid><dc:creator>davege</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I&amp;#39;m experiencing exactly the same problem using nrf52840 DK (PCA10056).&lt;/p&gt;
&lt;p&gt;If I set CONFIG_TIMING_FUNCTIONS=y, by default the Timing Zephyr subsystem will pick the architecture-dependent implementation (arch_).&lt;/p&gt;
&lt;p&gt;So, when invoking timing_init, this function in&amp;nbsp;&lt;em&gt;zephyr\arch\arm\include\aarch32\cortex_m\dwt.h&lt;/em&gt; will be invoked:&lt;br /&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;/**
 * @brief Initialize and Enable the DWT cycle counter
 *
 * This routine enables the cycle counter and initializes its value to zero.
 *
 * @return 0
 */
static inline int z_arm_dwt_init_cycle_counter(void)
{
	/* Clear and enable the cycle counter */
	DWT-&amp;gt;CYCCNT = 0;
	DWT-&amp;gt;CTRL |= DWT_CTRL_CYCCNTENA_Msk;

	/* Assert that the cycle counter is indeed implemented. */
	__ASSERT((DWT-&amp;gt;CTRL &amp;amp; DWT_CTRL_NOCYCCNT_Msk) != 0,
		&amp;quot;DWT implements no cycle counter. &amp;quot;
		&amp;quot;Cannot be used for cycle counting\n&amp;quot;);

	return 0;
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;And contextually, the assert is triggered.&lt;/p&gt;
&lt;p&gt;I think this is easily reproducible, I&amp;#39;m using a standard dev kit atm.&lt;br /&gt;I don&amp;#39;t have any other board to use with the same chip, but I don&amp;#39;t see any reason why it would mean that this board is faulty...&lt;/p&gt;
&lt;p&gt;Can anybody try to confirm this?&lt;br /&gt;It maybe a timing issue in the asserting condition.&lt;/p&gt;
&lt;p&gt;Note: I initially wondered why a benchmark sample (&lt;em&gt;latency measure&lt;/em&gt;) was working fine measuring time with DWT. I then realised that asserts are just disabled in the sample...&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;...
CONFIG_FORCE_NO_ASSERT=y
...&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Thanks in advance for your help!&lt;/p&gt;
&lt;p&gt;D&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: error: DWT implements no cycle counter. Cannot be used for cycle counting.</title><link>https://devzone.nordicsemi.com/thread/310031?ContentTypeID=1</link><pubDate>Tue, 18 May 2021 07:59:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:213edd95-cae6-420b-91c2-62675f238c30</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Here is my project, I used NCS v1.5.0, and I&amp;#39;m not able to re-create this when building for board nrf52833dk_nrf52833&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/timing.zip"&gt;devzone.nordicsemi.com/.../timing.zip&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;If you are not using&amp;nbsp;nrf52833dk_nrf52833 , then it might be an issue with your board files.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: error: DWT implements no cycle counter. Cannot be used for cycle counting.</title><link>https://devzone.nordicsemi.com/thread/309863?ContentTypeID=1</link><pubDate>Fri, 14 May 2021 17:24:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3d6b5d1d-6c9d-4f16-beae-c9bf6f8d397b</guid><dc:creator>moose</dc:creator><description>&lt;p&gt;I already have this config statement in my proj.conf.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: error: DWT implements no cycle counter. Cannot be used for cycle counting.</title><link>https://devzone.nordicsemi.com/thread/309792?ContentTypeID=1</link><pubDate>Fri, 14 May 2021 13:17:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b2b92c20-8f03-420a-8d25-83b1f09e6d2a</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Try setting this in prj.conf:&lt;/p&gt;
&lt;p&gt;&lt;span&gt;CONFIG_TIMING_FUNCTIONS=y&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: error: DWT implements no cycle counter. Cannot be used for cycle counting.</title><link>https://devzone.nordicsemi.com/thread/309661?ContentTypeID=1</link><pubDate>Thu, 13 May 2021 12:24:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:971add13-126a-482c-b70e-91d52d9e3cf4</guid><dc:creator>moose</dc:creator><description>&lt;p&gt;Any ideas?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>