This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

ADC12 in LPM4 Problem!

Dear all, 

I have a problem to reactivate ADC after the chip goes into LPM4. I have initialized the system and adc to measure voltage inputs and the process works fine without any problem. When the system goes into LPM4 I turn everything off. When I exit LPM4 I initilize the system again with the same initialization functions. However, the adc doesn't work, other system's components work perfect. Any idea!!

Please note that I use CC430 as a µC

Code Example of initialization:

void systemInitialization(void){

initClock();

IO_initialization();

#ifdef DEBUGING
UART_initialization();
#endif

ADC_initialization();

initTimer();

}

 

  • I wonder how you do the ADC initialization.
    But I assume that you leave the ADC in operating state when you go into LPM. So its 'initial' state after LPM and before the re-initialization is different from the original power-on state. So your init function might screw it up assuming power-on state where it isn't.

  • Thanks Jens-Michael, 

    Let me give you an overview of the whole process:

    1) I go to LPM4 and disable everything including ADC: ADC12CTL0 &= ~ADC12ON;
        I can achieve 1µA the datasheet specified 

    2) Reinitialized the µC and all input output port when exiting the LPM4 including the adc: 

       

    void ADC_initialization(void)
    {

    P2SEL = BIT0+BIT1+BIT2; // Enable A/D channel A0,A1,A2

    REFCTL0 |= REFMSTR+REFVSEL_2+REFON;

    /* Initialize ADC12 */
    ADC12CTL0 = ADC12ON+ADC12MSC+ADC12SHT0_8; 
    ADC12CTL1 = ADC12SHP+ADC12CONSEQ_3; 
    ADC12MCTL0 = ADC12SREF_1+ADC12INCH_0; // Vr+=Vref+ and Vr-=AVss
    ADC12MCTL1 = ADC12SREF_1+ADC12INCH_1; // Vr+=Vref+ and Vr-=AVss
    ADC12MCTL2 = ADC12SREF_1+ADC12INCH_2; // Vr+=Vref+ and Vr-=AVss

    __delay_cycles(75*26); // 75 us delay @ ~26MHz

    ADC12CTL0 |= ADC12ENC; 

    }

    I hope this gives you an overview of the system. 

    Note: i suspect that P2SEL has this effect after getting out from LPM4. I just read about the SEL function in datasheet. So I think I have to change it to GIOP not SEL. 

    I will test that and see what I can get. Any recommendation or solution. 

  • Fri_coder said:
    1) I go to LPM4 and disable everything including ADC: ADC12CTL0 &= ~ADC12ON;

    Do you also disable the ref module?

    Fri_coder said:
    i suspect that P2SEL has this effect after getting out from LPM4.

    If you take a look at the por tpin schematics in teh datasheet, ou'll see that P2SEL has almost no effect at all.
    The analog input is activated used solely by the INCHx. However, setting P2SEL and mapping the pin to PM_ANALOG will completely disable the whole digital part of this pin. However, the influence on the analog input if this isn't done is negligible if the port pin is in input direction and the pullups are disabled. Only that in this case the not disabled input buffer may oscillate and increase current consumption - without effect on the ADC.
    However, if you switch the port pins to low output (as recommended for low power), you activate the default secondary funciton on these pins. You didn't write which CC430 you use. For the 614x, for example, the default functions would be Cmparator B output on P2.0, TA1 CCR0 output on P2.1 and TA1 CCR1 output on P2.2. Which will of course influence the analog input. It will do so as soon as you set the port pins to output (whcih you probably do right before entering LPM)

  • Jens-Michael Gross said:
    Do you also disable the ref module?

    Yes I do turn off the ref Module, However it should be reactive when the adc initialization is called. 

    Jens-Michael Gross said:
    However, the influence on the analog input if this isn't done is negligible if the port pin is in input direction and the pullups are disabled.  

    Do you mean that I have to setup the pullups to be active with input direction? 

    Jens-Michael Gross said:
     if you switch the port pins to low output (as recommended for low power)

     Yes I do that. Exactly how to get back to the analog input measure after entering LPM4? 


  • Thanks Jens-Michael, 

    I have used the ports as analog i/o without the need for PxSEL, and the system reads the input voltage correctly after getting back from LPM4. 

**Attention** This is a public forum