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.

MSP430F5438A and EXP board current consumption

Other Parts Discussed in Thread: MSP430F5438A

Hello all.  I'm looking for some suggestions as to why I'm seeing such a drastic increase in current consumption (it was 70 - 80 uA, and now I'm seeing ~21 mA).  I'm using the MSP430F5438A on the associated EXPerimenter board.  I didn't want to make this a "debug my code for me" thread, but I've gone through my own code so many times I'm not seeing anything jump out at me.  And I figured re-typing it for here might help me spot something, too.

Here's my initialization code (with some repetitive lines left out, but mentioned in comments):

WDTCTL = WDTPW + WDTHOLD;    // Stop WDT
var1 = 0;        // initialize several variables to 0
v[0] = 0; ... v[9] = 0;        // Used later with ADC / DMA / I2C

// Clock Init
UCSCTL1 = DISMOD;    // Disable DCO Modulator
UCSCTL4 = SELA_2 + SELS_2 + SELM_2;    // ACLK = MCLK = SMCLK = REFO
UCSCTL6 = XT2OFF + SMCLKOFF + XT1OFF;    // XT2=OFF, SMCLK=OFF, XT1=OFF
__bis_SR_register(SCG0 + SCG1 + OSCOFF);    // Disable DCO, FLL, and LFXT1

// GPIO Init
PAOUT = 0; PADIR = 0xFFFF; PASEL = 0;    // initially set all ports (A, B, C, D, E, 11, J) as low outputs
// Setup some inputs with pulldown resistors
P4DIR &= ~BIT0;  P4REN |= BIT0;  P4OUT &= ~BIT0;
        ... repeat for other inputs
// Setup interrupts on P1 and P2 (P1 interrupt on low-high transition, P2 on high-low transition)
P1DIR &= 0x00;  P1REN |= 0xFF;  P1OUT &= 0x00;
P2DIR &= 0x00;  P2REN |= 0xFF;  P2OUT |= 0xFF;
P1IE |= 0xFF;
P2IES |= 0xFF;
P2IE |= 0x3F;        // 3F instead of FF because I use S1 and S2 on EXP board, P2.6 and P2.7
P1IFG &= 0x00;
P2IFG &= 0x00;

// ADC12 Init
// 32 sample & hold cycles; multiple samples; ADC12 on
ADC12CTL0 = ADC12SHT1_3 + ADC12SHT0_3 + ADC12MSC + ADC12ON;
// start storing results in MEM0; trigger with ADC12SC bit; single sequence of channels
ADC12CTL1 = ADC12CSTARTADD_0 + ADC12SHS_0 + ADC12SHP + ADC12CONSEQ_1;
ADC12CTL2 = ADC12RES_2 + ADC12SR + ADC12REFBURST;
// Note: not actual input channels below (changed for simplicity)
ADC12MCTL0 = ADC12SREF_2 + ADC12INCH_0;        // using external Vref+
        ...
ADC12MCLT4 = ADC12EOS + ADC12SREF_2 + ADC12INCH_4;
ADC12MCLT5 = ADC12SREF_2 + ADC12INCH_5;
        ...
ADC12MCTL9 = ADC12EOS + ADC12SREF_2 + ADC12INCH_9;
P6SEL |= 0xFF;  P5SEL |= 0x03;  P7SEL |= 0xF0;    // Associate proper pins with Analog input
// Do not enable ADC12 yet

// I2C Init
P3SEL |= 0x06;        // Assign I2C pins to USCI_B0
UCB0CTL1 |= UCSWRST;    // reset
UCB0CTL0 = UCMODE_3 + UCSYNC;    // I2C slave, synchronous mode
UCB0I2COA = 0x48;    // Assign an address
UCB0CTL1 &= ~UCSWRST;    // Clear reset; allow operation

// DMA Init
DMACTL0 = DMA1TSEL_19 + DMA0TSEL_24;    // DMA1 Trigger: UCB0TXIFG (I2C); DMA0 Trigger: ADC12IFG
DMACTL4 = DMARMWDIS;        // Disable read-write-modify
// repeated block transfer; increment SRC and DST address; enable
DMA0CTL = DMADT_5 + DMADSTINCR_3 + DMASRCINCR_3 + DMAEN;
DMA0SZ = 5;        // 5 words per block transfer
__data16_write_addr((unsigned short)&DMA0SA, (unsigned long)&ADC12MEM0);
__data16_write_addr((unsigned short)&DMA0DA, (unsigned long)&v[0]);
// Repeated single transfer; DST unchanged; SRC incremented; DST and SRC are bytes; enable
DMA1CTL = DMADT_4 + DMADSTINCR_3 + DMASRCINCR_3 + DMADSTBYTE + DMASRCBYTE + DMAEN;
DMA1SZ = 18;        // 9 ADC results to transfer over I2C (18 bytes)
__data16_write_addr((unsigned short)&DMA1SA, (unsigned long)&v[0]);
__data16_write_addr((unsigned short)&DMA1DA, (unsigned long)&UCB0TXBUF);

__bis_SR_register(GIE);    // Enable maskable interrupts
SFRIE1 |= WDTIE;    // Enable WDT timer interrupt

Then I enter an infinite loop for my main program.  Within this infinite loop, my code works as follows:

while (1) {
    P8OUT ^= 0x40;    // toggle P8.6 (I'm using an oscilloscope to measure the time it takes to return to this point)
    Reset WDT
    switch (MODE_variable) {
        // check certain ADC values from v[ ] depending on MODE, react appropriately
    }
    switch (MODE_variable) {
        // check certain digital inputs depending on MODE, go to a transition function to switch modes depending on inputs
    }
    ADC12CTL0 |= ADC12SC;    // trigger conversion
}

In my initial MODE, the ADC is not enabled, so no actual conversions are run.  It gets enabled during the transitions between modes.  It is also during these transitions that I make such changes as the ADC doing the sequence from MEM0 to MEM4 or MEM5 to MEM9, and changing the DMA to store the results in v[0] to v[4] or v[5] to v[9], respectively.

Initially I had everything except the I2C initialization (and associated DMA setup for I2C) and P1/P2 interrupt routines in the code.  Everything worked (as much as I could test and see), and my current consumption (running off battery without the programmer attached) was between 70 uA and 80 uA, which is what I expected.

Then I added the I2C code, as well as the code for my P1 and P2 interrupts (which just changes some outputs from high to low and some from low to high).  It was at some point after this that my current consumption drastically increased.  Initially, it was consuming about 43 mA.  I realized that the LCD on the EXP board was turning on for some reason.  I figured out that the backlight was controlled by P8.3, which is always off except if the P2 interrupt runs, which in my normal running should never occur, as those pins are not attached to anything, and have their appropriate pullup or pulldown resistors enabled.  Stepping through my code showed me that changing the P2IES register trigged interrupt flags, so I added the two lines that clear the P1 flags and P2 flags to the code.  Now the ISRs don't happen and the LCD backlight never turns on.  However, I am still using 21.2 mA of current.

I'm hoping to get some suggestions on if something in my code setup is initializing something that consumes that much current, or if there's some aspect of the EXP board that I'm not realizing that is drawing that much current.

As far as the EXP board goes, it has the following hardware peripherals listed in SLAU263d:

Dot-Matrix LCD: All they mention is that P8.3 controls the backlight driver.  As I said, I fixed my code so the P2 interrupt is not triggering, and P8.3 never goes high (the backlight is always dark).

Five-Directional Joystick: This is listed as connected to 2.1, 2.2, 2.3, and 2.4.  It doesn't list the fifth, but the wiring schematic shows the fifth direction connected to 2.5.  As expected, when I do trigger one of these, my P2 interrupt happens, 8.3 goes high, and the LCD backlight turns on, and the current jumps up to 43.3 mA.

Push buttons (S1, S2): Connected to 2.6 and 2.7.  I'm using these to simulate two of the inputs (and set P2IE to 0x3F so they wouldn't cause an interrupt).

LED1 and 2: Connected to 1.0 and 1.1/TA0 CCR0.  All ports on P1 are connected to pulldown resistors, and these never trigger.  I do not have any timers (TA0, TA1, TB0) enabled.

Wireless Evalutation Module Interface / eZ430-RF2500T Interface:  It mentions these being powered by the RF PWR jumper.  My current consumption is the same regardless of this jumper's status.

Two-Axis Accelerometer:  Powered through P6.0.  I do not using P6.0 in my design.  P6.0 is also ADC input A0, which I also do not use.  I did set the PxSEL bits to make P6.0 an analog input.  I don't believe this would be powered with these settings, but could I be wrong?  Yet my current consumption remained low with these same settings before I added I2C/DMA for I2C/P1 and P2 interrupts.

Analog Signal Chain: Powered through P6.4.  This is the same scenario as P6.0 above (this is A4).  I do use A4 in my measurements.  Yet the same question arises: it did not consume power before with these same settings, so why would it suddenly use 21 mA now?

So yeah... I've spent the last couple of days trying to figure out where this jump in current consumption is coming from, but I'm at my wit's end.  I did try commenting out my code that setup the I2C, DMA for I2C, and the P1 and P2 interrupts, but I'm still getting this massive current consumption.  Anyone have suggestions or comments?

Thank you.

  • Such a drastical increase of power consumption is surely not cause by the MSP internal hardware. If shouldn't consume more than 7mA under any circumstances. Except for port driving currents. So I'd check the hardware, port pins and such, if something is 'glowing' :)

    Maybe some external circuitry is pulling a line low which the MSP wants to pull high. This can cause such a current increase.

    Sorry, I don't have the time to look into your code yet (my office hours are already over for this week)

  • I figured out my problem.  I'm using almost all 83 I/O pins in my design, so I went through each pin individually, checking to which signals I had assigned it and checking the EXP board schematic (in SLAU263D) to see what it was connected to on there.  It turns out that pins 9.1 and 9.2 are tied together on the EXP board.  I had assigned to those pins signals that are always the opposite of each other.  I moved some pin assignments around so this is no longer the case, and my current consumption is back to normal.

    You wouldn't have been able to figure out this one for me specifically, Jens-Michael, since I hadn't bothered to list all of my I/O port assignments.  But thank you for suggesting I check the port pins and such.

**Attention** This is a public forum