AnsweredAssumed Answered

using sleep mode (power saving)

Question asked by kilshtein.daniel on Dec 26, 2012
Latest reply on Dec 26, 2012 by STOne-32

I'm working on a project where power saving is a critical issue and I need some help with the power mode (sleep).

Here is a short description of the project structure:

Main goals:
Save an image form the camera each second to the SD card
Save value from ADC each second to the SD card
Save as much power as possible

After init, I have three interrupts and three tasks:

Interrupts:
Tick (timer) – for the OS (FreeRtos)
     Call the xPortSysTickHandler
DMA transfer for the camera
     Clear ISR
     Start camera task
ADC complete for the ADC
     Clear ISR
     Start ADC task

Tasks:
Camera task
     Disable the DCMI
     Set a flag to indicate that there is a new frame
ADC task
     Disable ADC
     Set a flag to indicate that there is a new value
Background task
     Check the flags to find out if there is any data to save (flags from the two above tasks).
     Is so, save to file and readable DCMI and ADC
     Set a delay for the background task (vTaskDelay)
     The go to sleep

This is how the background task looks like:

while(1)
  {
   
    //check for new data from the camera or ADC
    Background_OP();
        
    //set a small delay for this task
    vTaskDelay(40);
    
    //ZZZ...
    __WFI();
    
  }
}

Everything works fine but I'm not sure about the sleep mode.
Is this the way to use __WFI() function?
Is there a better way to handle power consumption?

Outcomes