This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Optimisation level in SES - nrf52832 + ICM20948

Hi,

I am developing an  ESB application with 1 central (nrf52832 DK) and several peripheral.  The peripheral are nrf52832 + ICM 20948.  Development is done with Segger embedded studio (SES) .

I am using SDK16, the latest.

 Application on the peripheral is working correctly in debug mode, although power consumption is higher that  would like while CPU resting.  

I have tried to compile the program in Release mode but I have ran in issues.   

I have tried to understand the difference between Debug and Release mode

I have  found that the preprocessor definition have some difference.

for Debug mode :  "DEBUG; DEBUG_NRF" from solution in Debug configuration  ;     For Release mode :  "NDEBUG"

DEBUG or NDEBUG does not affect the program operation.

In Code generation section:  Optimisation level is set differently.  

I ahve found out that  Optimisation level 0 work fine. This is the setting for DEBUG mode.

With Optimisation level 1 or 2,  the CPU does not communicate correctly with the ICM.  

When I try to read the quaternions, I get some blank instead of numbers.   Power consumption is not improved.

Optimisation level 1 and specially 2 are supposed to make the program more efficient and consume less power.  

Any Idea why it does not work with the ICM?

Regards,

Sylvain

Parents Reply
  • Hi, I have found that the main culprit is the HFCLK used for the ESB.  I have to do more measurement and testing today.  

    nrf_drv_clock_hfclk_release(); // does nothing

    NRF_CLOCK->TASKS_HFCLKSTOP = 1;  //  power consumption drop from 200µA to almost nothing, less than 40µA.  Its time to get my scope to get more precise data.


    Now the problem is that I don't know how to restart the clock.

    Calling the clocks_start routine does not do the trick.

    void clocks_start( void )
    {
        NRF_CLOCK->EVENTS_HFCLKSTARTED = 0;
        NRF_CLOCK->TASKS_HFCLKSTART = 1;
        while (NRF_CLOCK->EVENTS_HFCLKSTARTED == 0);
    
    }

    Any suggestion ?

Children
Related