CPU dont go to sleep

Hi!

I am using nrf32840 with free rtos,

and I have a loop that do the following

for(;;){

    vTaskDelay(pdMS_TO_TICKS(intervalTime)); // go to sleep due to portSUPPRESS_TICKS_AND_SLEEP( xExpectedIdleTime );

 

    // do some work

}

 

The problem is as follow:

In most of my devices, the CPU goes to a deep sleep mode and the current is 200micro,

 

In some of my devices, it seems that the CPU don’t go to sleep, and the current is bigger then 6mA,

 

In some other devices the problem sometimes occurs and sometimes not...

 

 

I tried the following with the devices that always do has the problem:

  1. Write the example hex of ble_app_hrs_freertos.hex, and the current was 200micro, so it seems that the micro controller is fine.
  2. check if I get unexpected interrupts, so I used __disable_irq() sd_nvic_critical_region_enter(), but it doesn’t seem to help as well.
  3. I used a debugger and made sure it got to the idle task and the portSUPPRESS_TICKS_AND_SLEEP() function had been called.

 

 

I am out of ideas, do you have any suggestion why that could happen, and how to solve it?

Related