Using Const Variables Makes Current Goes Up

Hi!

I'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 "const":

const float hamming[] = {
0.08000000000000002,
0.08000054147657765,
0.08000216590503589,
0.08000487328155026,
0.08000866359974718,
0.080013536850703,
0.0800194930229452,
0.08002653210245131,

...

There is the multplication:

void hamming_windowing(int16_t *signal, uint32_t size)
{
   int i = 0;
   for (i = 0 ; i < size/2; i++)
   {
       signal[i*2] = signal[i*2] * hamming[i] ;
   }
}

But when I multiple an array with this const array, the power consumption goes up to 7 mA. I'm able to achieve 15 uA without this operation. I suspect that something is going on with the flash. What can be the issue?

Thank you!

Parents
  • In fact, I changed the const windows for a calculated window:

    void hamming_windowing(int16_t *signal, uint32_t size)
    {
       int i = 0;
       for (i = 0 ; i < 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;
       }
    }

    I still get the same high current consumption. So doesn'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 sd_app_evt_wait(); in my super loop, I get a high power consumption after the operation. When I change sd_app_evt_wait(); for:

    __SEV();
    __WFE();
    __WFE();

    And I disable soft device, I don't have this problem.

    Then I try this sleep in my super loop :

    __SEV();
    __WFE();
    __WFE();
    nrf_drv_wdt_channel_feed(m_channel_id); // Kick Watchdog
    sd_app_evt_wait();

    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?

    Thank you!

Reply
  • In fact, I changed the const windows for a calculated window:

    void hamming_windowing(int16_t *signal, uint32_t size)
    {
       int i = 0;
       for (i = 0 ; i < 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;
       }
    }

    I still get the same high current consumption. So doesn'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 sd_app_evt_wait(); in my super loop, I get a high power consumption after the operation. When I change sd_app_evt_wait(); for:

    __SEV();
    __WFE();
    __WFE();

    And I disable soft device, I don't have this problem.

    Then I try this sleep in my super loop :

    __SEV();
    __WFE();
    __WFE();
    nrf_drv_wdt_channel_feed(m_channel_id); // Kick Watchdog
    sd_app_evt_wait();

    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?

    Thank you!

Children
No Data
Related