<?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>Using Const Variables Makes Current Goes Up</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/90395/using-const-variables-makes-current-goes-up</link><description>Hi! 
 I&amp;#39;m developping a battery powered product, so the power consumption is important. I need to multiple an array point by point with an array (hamming window) that I store in the flash as &amp;quot;const&amp;quot;: 
 
 
 
 There is the multplication: 
 
 
 But when</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 11 Aug 2022 14:42:20 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/90395/using-const-variables-makes-current-goes-up" /><item><title>RE: Using Const Variables Makes Current Goes Up</title><link>https://devzone.nordicsemi.com/thread/381228?ContentTypeID=1</link><pubDate>Thu, 11 Aug 2022 14:42:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:be660076-5a92-47a6-9ad5-e85527101a29</guid><dc:creator>PB</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I think you should look for &lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;-mfloat-abi=soft -msoft-float&lt;/span&gt;&amp;nbsp;in your project makefile. Likely it&amp;#39;s set to &amp;quot;hard&amp;quot; which enables the FPU. At leat that&amp;#39;s something which helped me with similar issue. There should be some examples in the nRF SDK which will help with all the flags magic.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;PB&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using Const Variables Makes Current Goes Up</title><link>https://devzone.nordicsemi.com/thread/378973?ContentTypeID=1</link><pubDate>Wed, 27 Jul 2022 15:54:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:62a20305-ad9f-4f59-ac6b-4d9cbb6de18a</guid><dc:creator>Emile</dc:creator><description>&lt;p&gt;Well the power consumption seemed to be due to the fact that my const array was stored as float. I changed it to double and the problem seems to be gone. What could explain this rise in power consumption? Was it because other section of the CPU was enabled for this operation when the array was stored as a float?&lt;/p&gt;
&lt;p&gt;Thank you!&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using Const Variables Makes Current Goes Up</title><link>https://devzone.nordicsemi.com/thread/378931?ContentTypeID=1</link><pubDate>Wed, 27 Jul 2022 13:20:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:57fb364a-634f-4319-b078-5b03c146cb11</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Check out:&lt;br /&gt;&lt;a href="https://infocenter.nordicsemi.com/topic/errata_nRF52832_Rev2/ERR/nRF52832/Rev2/latest/anomaly_832_87.html#anomaly_832_87"&gt;https://infocenter.nordicsemi.com/topic/errata_nRF52832_Rev2/ERR/nRF52832/Rev2/latest/anomaly_832_87.html#anomaly_832_87&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;If you are using the softdevice you should always use&amp;nbsp;&lt;span&gt;sd_app_evt_wait(), not __WFE() directly.&lt;/span&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: Using Const Variables Makes Current Goes Up</title><link>https://devzone.nordicsemi.com/thread/378777?ContentTypeID=1</link><pubDate>Tue, 26 Jul 2022 16:06:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cfb0634e-c101-4685-abe9-357db9c196de</guid><dc:creator>Emile</dc:creator><description>&lt;p&gt;In fact, I changed the const windows for a calculated window:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;void hamming_windowing(int16_t *signal, uint32_t size)
{
   int i = 0;
   for (i = 0 ; i &amp;lt; size/2; i++)
   {
       hamming_element = 0.54 - 0.46 * cos(2*3.1416*i/(size/2-1));
       signal[i*2] = signal[i*2] * hamming_element;
   }
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I still get the same high current consumption. So doesn&amp;#39;t seem to be related to the fact that my array was declared as const. It seems to be related to soft device. When I use&amp;nbsp;sd_app_evt_wait(); in my super loop, I get a high power consumption after the operation. When I change&amp;nbsp;sd_app_evt_wait(); for:&lt;/p&gt;
&lt;p&gt;__SEV();&lt;br /&gt; __WFE();&lt;br /&gt; __WFE();&lt;/p&gt;
&lt;p&gt;And I disable soft device, I don&amp;#39;t have this problem.&lt;/p&gt;
&lt;p&gt;Then I try this sleep in my super loop :&lt;/p&gt;
&lt;p&gt;__SEV();&lt;br /&gt; __WFE();&lt;br /&gt; __WFE();&lt;br /&gt; nrf_drv_wdt_channel_feed(m_channel_id); // Kick Watchdog&lt;br /&gt; sd_app_evt_wait();&lt;/p&gt;
&lt;p&gt;But SEV, WFE, WFE with softdevice enable seems to make current goes to 800 uA. So how can a simple operation in my code with soft device enable makes current consumption go up?&lt;/p&gt;
&lt;p&gt;Thank you!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>