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.

MSP430 F2002 Power Consumption far too high

Other Parts Discussed in Thread: MSP430F2002

Hello Everyone,

i am currently trying to realize certain some small scale projects with the MSP430. My latest project consists of a gold-cap powered F2002 which is turning on a LED if a light sensor detects darkness. The 1 Farad gold-cap is charged by a solar cell. The hardware works fine. However, it seems as if the MSP is using too much power.

The 1 F capacitor will discharge from 3.6V to 1.8V within 1 hour (LED not working of course). i pulled the RST pin to Ground and the result was a much lower power consumption, so the problems clearly originates from the MSP430. 

i attached my Assembler Code. Hope, anyone finds a mistake in it, so there is a way to improve this.

#include "msp430f2002.h"
;-------------------------------------------------------------------------------
main ORG 0FC00h ; Progam Start (1K Flash device)
;-------------------------------------------------------------------------------

RESET mov.w #0280h,SP              ; Set stackpointer (128B RAM device)

SetupP1
mov.b #0FEh,&P1DIR     ; Set P1.1 - P1.7 to output 11111110
mov.b #0C0h,&P2DIR                      ; Set P2.6 - P2.7 to output 11000000
mov.b #000h,&P1OUT                     ; All Outputs to 0
mov.b #001h,&P1SEL                      ; Set P1.0 to Fkt Mode
StopWDT mov.w #WDTPW+WDTHOLD,&WDTCTL ; Stop watchdog timer

BASIC_T
bic.b #XTS,&BCSCTL1 ;
bis.b #XT2OFF,&BCSCTL1
bis.b #SELM_3,&BCSCTL2
bis.b #LFXT1S_2,&BCSCTL3 ; Use VLO

TA_INIT
clr.w &TACTL
mov.w #CCIE,&TACCTL0
mov.w #01000h,&TACCR0
mov.w #TASSEL_1+ID_2,&TACTL
bis.w #MC_1,&TACTL

ADC_INIT
mov #SREF_1+ADC10SR+REFBURST+REFON+ADC10ON,&ADC10CTL0
bis.b #BIT0,&ADC10AE0

;--- Registerinit ---
REG_INIT clrc
mov #0000h,R5 ; R5 = Analog Value n
mov #0000h,R6 ; R6 = Analog Value n-1
mov #00C0h,R7 ; R7 = Value Darkness
mov #0000h,R8 ; R8 = Temp Result
mov #00A0h,R9 ; R9 = Value Change

;--- LPM CPU ---
eint
LPM nop
bis.w #CPUOFF+SCG1+SCG0+GIE,SR ; Enter LPM3
nop
jmp LPM

;--- Interrupt Service Routinen ---
;--- Isr TA0 ---
TA0_ISR
nop
dint
cont mov.w #01000h,&TACCR0
bic.b #BIT3,&P1OUT
bis #ENC+ADC10SC+ADC10ON,&ADC10CTL0
Wait bit #ADC10IFG,&ADC10CTL0
JZ Wait
mov.w R5,R6
mov.w &ADC10MEM,R5
bic #ENC+ADC10SC+ADC10ON,&ADC10CTL0
cmp.w R5,R7 ; R7 - R5
JLO Nacht ; R7 < R5
JMP End_Isr
Nacht mov.w R5,R8 ; copy n Value to R8
sub R6,R8 ; R8 - R6 -> R8, (Value n) - (Value n-1)
bit #BIT2,SR ; Result negative?
JNZ End_Isr ; if n < n-1
cmp.w R9,R8 ; R8 - R9
JLO End_Isr ; R8 < R9
bis.b #BIT3,&P1OUT
mov.w #0FFFFh,&TACCR0
End_Isr bic #TAIFG,&TACTL
bic #ADC10IFG,&ADC10CTL0
bic #CPUOFF+SCG1+SCG0,0(SP)
eint
reti
;-------------------------------------------------------------------------------
; Interrupt Vectors
;-------------------------------------------------------------------------------
ORG 0FFFEh ; MSP430 RESET Vector
DW RESET
ORG 0FFF2h ; Timer_A0 Vector
DW TA0_ISR
END

Thanks a lot!

Andy

  • dint/eint isn't necessary in an ISR. At ISR entry, SR is saved to stack (including GIE) and GIE is cleared. The RETI instructions restores SR from stack, including the previous GIE state.
    Using eint inside the ISR is dangerous too, as this allows another itnerrupt itnerrupting th eISR while it hasn't returned yet. Worst case, this leads to an endless chan of interrutped interrupts, each one leaving 4 bytes on the stack until it overflows.
    It's not related to your problem, but a problem of its own.

    Another problem: (Ab)using processor registers as global variables isn't a good idea. Using a memory location instead doesn't add too much overhead and is transparent. As long as the code is small, this may work fine, but when the code size grows, altering processor registers inside an ISR is begging for trouble. It also limits the available registers for more complex tasks, making the code less efficient.

    About the power consumption, discharging 1.8V in one hour means an average current of 500µA. Quite much. In fact, without having a crystal, it should be significantly lower. However, your code leaves LF_XT1 active. YOu should permanently set the OSCOFF bit in SP to deactivate the XT1 oscillator which is permanenlty trying to fire up the 32kHz crystal, taking more current than when there were a crystal.
    However, main power consumption is due to the ADC, which is on all the time and the reference is on too (even if in burst mode). I'd say this is you main current sink.

    What you can do: the timer ISR doesn't start the conversion, Instead, it enables the ADC and the reference and starts another timer (to let the reference settle). The second timer starts the conversion, and when the conversion is done, the ADC10 ISR processes the result and disables the DC and the reference.

    A little bit more complex (especially if you have to re-assign the timer for two different tasks) but who said that reaching lowest power consumption while still using power-consuming features is easy.

  • Hallo Jens,

    thank you so much!!!!!!!!

    I will try to realize all you suggestions. And i will reply to you once more after next weekend!


    Honestly

    Andy

**Attention** This is a public forum