<?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>Quadrature Decoder Failing to build on NCS v2.1</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/92639/quadrature-decoder-failing-to-build-on-ncs-v2-1</link><description>Hello, When enabling the Sensor system and having a qdec device enabled in my dts I get the following error: 
 
 
 This seems to be a bug with the Zephyr code checking a const local var at compile time. Has anyone else had this issue? 
 
 Best, 
 
 A</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 11 Oct 2022 09:27:04 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/92639/quadrature-decoder-failing-to-build-on-ncs-v2-1" /><item><title>RE: Quadrature Decoder Failing to build on NCS v2.1</title><link>https://devzone.nordicsemi.com/thread/390213?ContentTypeID=1</link><pubDate>Tue, 11 Oct 2022 09:27:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3962329c-faa0-4639-98cf-60bfc4b627f4</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Not likely that it will be backported, but you should be able to patch the SDK yourself once the fix is merged to upstream Zephyr repository.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Quadrature Decoder Failing to build on NCS v2.1</title><link>https://devzone.nordicsemi.com/thread/390205?ContentTypeID=1</link><pubDate>Tue, 11 Oct 2022 09:13:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:323c4241-8755-46c3-9c6d-ad391d0ac8de</guid><dc:creator>ArchieA_C</dc:creator><description>&lt;p&gt;Great thanks, will this be&amp;nbsp;backported to V2.1 or will I need to wait till V2.2?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Quadrature Decoder Failing to build on NCS v2.1</title><link>https://devzone.nordicsemi.com/thread/390193?ContentTypeID=1</link><pubDate>Tue, 11 Oct 2022 08:48:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c3640dce-a733-4db1-beac-0f68a26e8ea2</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Fix is being discussed in &lt;a href="https://github.com/zephyrproject-rtos/zephyr/pull/51140"&gt;this pull request&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Jørgen&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Quadrature Decoder Failing to build on NCS v2.1</title><link>https://devzone.nordicsemi.com/thread/390080?ContentTypeID=1</link><pubDate>Mon, 10 Oct 2022 15:14:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c85c73a6-92c6-4e42-9bea-4747094630c3</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I was able to reproduce the issue with&amp;nbsp;&lt;span&gt;`CONFIG_NO_OPTIMIZATIONS=y` config set. I have reported&amp;nbsp;it internally.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;We do not have any other methods to report DevZone&amp;nbsp;issues than creating a ticket. We are aware of the issues you have seen, F5 usually helps with showing the buttons.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Best regards,&lt;br /&gt;Jørgen&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Quadrature Decoder Failing to build on NCS v2.1</title><link>https://devzone.nordicsemi.com/thread/390004?ContentTypeID=1</link><pubDate>Mon, 10 Oct 2022 11:55:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9f64ec56-537a-4a1a-abb1-94b746835f56</guid><dc:creator>ArchieA_C</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;&lt;span&gt;J&amp;oslash;rgen&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="text-decoration:line-through;"&gt;It seems to be an issue when enabling CPLUSPLUS. Could you add `CONFIG_CPLUSPLUS=y` to your proj.conf in your test up and see if it errors?&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Edit: Actually it seems to be the `CONFIG_NO_OPTIMIZATIONS=y` option.&lt;/p&gt;
&lt;p&gt;Also, how do I report an issue with the DevZone website? I have noticed that the &amp;quot;Reply&amp;quot;, &amp;quot;Verify Answer&amp;quot; and &amp;quot;More&amp;quot; buttons do not appear next to posts unless I interact with those buttons on a post a level above the one I want to interact with. I can provide a video if that helps.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;Thanks,&lt;/p&gt;
&lt;p&gt;Archie&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Quadrature Decoder Failing to build on NCS v2.1</title><link>https://devzone.nordicsemi.com/thread/389816?ContentTypeID=1</link><pubDate>Fri, 07 Oct 2022 12:08:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:12e30a86-628d-4746-913c-f33cd6748225</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I&amp;#39;m not able to reproduce this error. I tried adding QDEC to a simple example, but there are no build errors.&lt;/p&gt;
&lt;p&gt;The QDEC is also used in our nrf_desktop mouse application, so it should have been tested and builds with our tests.&lt;/p&gt;
&lt;p&gt;Can you upload a simple application that we can use to reproduce this error?&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Jørgen&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Quadrature Decoder Failing to build on NCS v2.1</title><link>https://devzone.nordicsemi.com/thread/389682?ContentTypeID=1</link><pubDate>Thu, 06 Oct 2022 15:51:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9755e6de-3e70-4232-9fc1-eb03a16ef85c</guid><dc:creator>ArchieA_C</dc:creator><description>&lt;p&gt;It has been configured as shown below:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;&amp;amp;qdec0{
	compatible = &amp;quot;nordic,nrf-qdec&amp;quot;;
	status = &amp;quot;okay&amp;quot;;
	led-pre = &amp;lt;0&amp;gt;;
	steps = &amp;lt;12&amp;gt;;

	pinctrl-0 = &amp;lt;&amp;amp;qdec0_default&amp;gt;;
	pinctrl-1 = &amp;lt;&amp;amp;qdec0_sleep&amp;gt;;
	pinctrl-names = &amp;quot;default&amp;quot;, &amp;quot;sleep&amp;quot;;	
};&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt; It seems to be the qdec code that is wrong as it&amp;#39;s saying the expression isn&amp;#39;t constant.&lt;br /&gt;&lt;br /&gt;Modifying the code to this:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static int qdec_nrfx_channel_get(const struct device *dev,
				 enum sensor_channel  chan,
				 struct sensor_value *val)
{
	struct qdec_nrfx_data *data = &amp;amp;qdec_nrfx_data;
	unsigned int key;
	int32_t acc;
	const int32_t steps = DT_INST_PROP(0, steps);

	ARG_UNUSED(dev);
	LOG_DBG(&amp;quot;&amp;quot;);

	if (chan != SENSOR_CHAN_ROTATION) {
		return -ENOTSUP;
	}

	key = irq_lock();
	acc = data-&amp;gt;acc;
	data-&amp;gt;acc = 0;
	irq_unlock(key);

	BUILD_ASSERT(DT_INST_PROP(0, steps) &amp;gt; 0, &amp;quot;only positive number valid&amp;quot;);
	BUILD_ASSERT(DT_INST_PROP(0, steps) &amp;lt;= 2048, &amp;quot;overflow possible&amp;quot;);

	val-&amp;gt;val1 = (acc * FULL_ANGLE) / steps;
	val-&amp;gt;val2 = (acc * FULL_ANGLE) - (val-&amp;gt;val1 * steps);
	if (val-&amp;gt;val2 != 0) {
		val-&amp;gt;val2 *= 1000000;
		val-&amp;gt;val2 /= steps;
	}

	return 0;
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Fixes the error as now the value is a compile-time constant.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Quadrature Decoder Failing to build on NCS v2.1</title><link>https://devzone.nordicsemi.com/thread/389673?ContentTypeID=1</link><pubDate>Thu, 06 Oct 2022 14:49:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4bbfc39b-83a7-4423-a327-6fff423b5e9d</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;You need to configure the QDEC in the devicetree or overlay file for the project, see the example in &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/71607/adding-qdec_nrfx-to-a-project/294419"&gt;this post&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Can you check if you still get the build asserts with this set?&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Jørgen&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>