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.

Strange power consumption behaviour with a Stellaris Launchpad

I noticed a very strange behaviour in power consumption, with a Stellaris Launchpad.

Given the following code:

#include "inc/hw_types.h"
#include "inc/hw_memmap.h"
#include "driverlib/sysctl.h"

int main(void)
{
    volatile int i = 0;

    SysCtlClockSet(SYSCTL_SYSDIV_2 | SYSCTL_USE_OSC | SYSCTL_XTAL_16MHZ
                    | SYSCTL_OSC_MAIN);

    while(1);
}

Measuring the current lead to a result of 9.52 mA. Hovever, if I insert some useless instructions into the while cycle (for example

while(1) {i++; i--; i++; i--;}

the current load drops to 7.38 mA.

I'm using CCS 5.3.0.

Any idea about this issue? It seems like the branch instruction draw more power than other instructions.

Thank you,

  Teo