FRDM--KL25Z POWER MODES

11 May 2015

Hello everyone!I am working on frdm-kl25z platform in Keil UVISION 4 IDE. I would like to know if there is any program-code example which can shows us the different power stages. How can i enter WAKE,SLEEP,DEEP SLEEP modes??

11 May 2015

I assume you are using mbed libraries?

sleep(); makes it enter sleep mode.

deepsleep(); maakes it enter deepsleep mode.

Interrupts are used for both to go to normal run mode again. (In sleep all interrupts function, in deepsleep only a select few which does not require the main clock to be active, for example InterruptIn works).

11 May 2015

i would appreciate it if you could send me an example code with sleep(); deepsleep(); functions inside! And how can i use the interrupts??

11 May 2015

#include "mbed.h"

int main() {
  sleep();
  deepsleep();
}

That has the functions there. Of course not useful further: So what is the part you don't understand? I gladly help people, but you do need to show some own initiative. Also for pin interrupts you use InterruptIn.

12 May 2015

for example:You push the red button in the slider and the program makes an addition (a=a+5).Then you push the blue and we get into sleep mode.After that you push the green led and the platform wakes up and makes a division (a=a/2)..

12 May 2015

How do you mean buttons on the slider?

However simple one button example (you need to change it to a physical button you use, buttons are easier than slider for sleep/deepsleep): (Untested)

#include "mbed.h"

InterruptIn iin(A0);
DigitalOut led(LED_GREEN);

void ifunction(void) {
}

int main() {
  led = 1;
  iin.rise(ifunction);

  while(1) {
    sleep();
    led = 0;
    wait(0.5);
    led = 1;
  }
}
13 May 2015

thanks this was very helpful! One more thing.. Do you know how can I disable the accelerometer or the OpenSDA or some clocks? I am talking on MDK 4 IDE KEIL