Skip to main content
lukas239955_stm1_stmicro
Associate
June 27, 2011
Question

ADC Calibration needed after Wakeup from Sleep ?

  • June 27, 2011
  • 0 replies
  • 440 views
Posted on June 27, 2011 at 23:53

Hello,

to reduce powerconsumption during sleep the ADC and DMA are stopped befor the controller is send to sleep mode.

What is the correct sequence to start an ADC conversion after wakeup from sleep ?

Is the ADC calibration sequence needed in the wakeup sequence ?

Here is my actual code

      // Prepare for Sleep: Stop ADC and DMA Peripherie (and there Clocks)

      ADC_Cmd(ADC1, DISABLE);

      DMA_Cmd(DMA1_Channel1, DISABLE);

      ADC_SoftwareStartConvCmd(ADC1, DISABLE);

      RCC_AHBPeriphClockCmd(RCC_AHBPeriph_DMA1, DISABLE);

      RCC_APB2PeriphClockCmd(RCC_APB2Periph_ADC1, DISABLE);  

     ....

     ....

     // Request Sleep Mode

        __WFI();

Here is the code to start ADC Conversion after wakeup

    // Enable ADC, DMA and Start a Conversion Sequence

    RCC_AHBPeriphClockCmd(RCC_AHBPeriph_DMA1, ENABLE);

    RCC_APB2PeriphClockCmd(RCC_APB2Periph_ADC1, ENABLE);

    DMA_SetCurrDataCounter(DMA1_Channel1,    ADC_CONVERTED_VALUE_TAB_LENGTH);

    DMA_Cmd(DMA1_Channel1, ENABLE);

    ADC_Cmd(ADC1, ENABLE);

    ADC_SoftwareStartConvCmd(ADC1, ENABLE)

Many Thanks,

Lukas
    This topic has been closed for replies.