Hi guys, me again
http://e2e.ti.com/support/microcontrollers/msp430/f/166/t/356755.aspx
Still using the MSP430FR6989, but this topic is different and is more general so I will start a second thread. For those who did not read my other post which I have linked in above - I'm trying to find the best settings for reducing the current consumption to minimum while still having enough computation resources to handle some tasks.
What have I done? Well, as mentioned I'm using the MSP430FR6989 and set the DCO to work with 2.67MHz (one of the calibrated frequencies). This clock is sourcing MCLK and SMCLK. ACLK is sourced by the 10kHz VLOCLK. Now I wanted to figure out which action consumes how much power and I am a little bit confused about the result.
This is my simple code:
#include "mcu_configuration.h" #include <stdint.h> volatile uint16_t var_counter = 0; void main( void ) { // Watchdog timer is stopped in _system_pre_init mcu_configure_ports(); mcu_configure_clock_module(); while( 1 ) { var_counter++; if( MCU_BUTTON_LEFT_PRESSED ) TEST_LED_1_ON; else TEST_LED_1_OFF; if( MCU_BUTTON_UP_PRESSED ) TEST_LED_2_ON; else TEST_LED_2_OFF if( MCU_BUTTON_ENTER_PRESSED ) TEST_LED_3_ON; else TEST_LED_3_OFF if( MCU_BUTTON_DOWN_PRESSED ) TEST_LED_4_ON; else TEST_LED_4_OFF; if( MCU_BUTTON_RIGHT_PRESSED ) TEST_LED_5_ON; else TEST_LED_5_OFF; } }
The definitions represent nothing more than
if( ~P6IN & 0x01 ) P6OUT |= 0x20;
There are 5 buttons and five LEDs which are switched on and off depending on the state of the buttons. Now I ran the program in four different ways:
1.: Complete program as it is listed above - result of current consumption (USBFET disconnected): 412uA
2.: Only counting up the variable, reading from inputs and writing to outputs marked out - result: 234uA (NICE!!!)
while( 1 ) { var_counter++; //if( MCU_BUTTON_LEFT_PRESSED ) TEST_LED_1_ON; //else TEST_LED_1_OFF; ... }
3.: Counting the variable and only read the inputs without doing anything on the outputs - result: 368uA
while( 1 ) { var_counter++; if( MCU_BUTTON_LEFT_PRESSED ); //TEST_LED_1_ON; //else TEST_LED_1_OFF; ... }
4.: Counting the variable and only writing to ports (without change) - result: 446uA
while( 1 ) { var_counter++; /*if( MCU_BUTTON_LEFT_PRESSED )*/ TEST_LED_1_ON; //else TEST_LED_1_OFF; ... }
I cannot imagine why these current consumptions occur. Why do the port-actions require so much current and why consumes reading and writing from and to the ports less power while doing more with respect to only write the outputs while they never change?
Is there anybody of you that has an idea for that? I'm trying to reduce the current consumption to the absolute minimum - but: I need a static low current without using the low-power-modes. I'm not having a battery-powered application. I just need ultra-low-power while active.
Thanks, Dennis