MIPS On-Off

MIPS on/off

This sketch uses the Energy Saving library for MIPS and MCU power management. 
In particular in this example is shown how you can power up or power down the MIPS side from the MCU serial console.

Hardware

- Arduino Tian

Circuit

Arduino Tian 
Plug the board to the computer and upload the code. 
Note: 
The board must be powered with one power supply that provides output at least 2A. 
You may need to use a Y-Cable (USB Micro-B to Standard Male A).

Code

 
 
/*
 
This sketch allows the users to manage the Tian power management.
Users can power up or power down the MIPS side from the MCU serial console.
 
After upload the sketch, open the Serial Terminal and press the send button.
 
COMMANDS
----------------------
h - help
D - power down MIPS
U - power up MIPS
 
created March 2016
by andrea@arduino.org
 
*/
 
#define MIPS_PIN 32 //PA28 PIN 32
 
char var;
 
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
pinMode(13,OUTPUT);
pinMode(MIPS_PIN,OUTPUT);   //MIPS
digitalWrite(MIPS_PIN,HIGH);
while(!Serial.available());;
menu('h');
}
 
void loop() {
// put your main code here, to run repeatedly:
while (Serial.available()){
  var = Serial.read();
  menu(var);
}
}
 
void menu( char var){
    switch (var) {
    case 'D':
      Serial.println("MIPS OFF");
      Serial.println();
      digitalWrite(MIPS_PIN,LOW);
      break;
    case 'U':
      Serial.println("MIPS ON");
      Serial.println();
      digitalWrite(MIPS_PIN,HIGH);
      break;
    case 'h':
      Serial.println("COMMANDS");
      Serial.println("----------------------");
      Serial.println("h - help");
      Serial.println("D - power down MIPS");
      Serial.println("U - power up MIPS");
      Serial.println();
      break;
  }
 
}
 
 

Output

After that you have uploaded the sketch, open the Serial Terminal and press the Send button to know the commads: 
Power down MIPS 
If you want power down MIPS, then type D on the Serial Terminal. 
Power down MIPS 
If instead you want power up MIPS, then type U on the Serial Terminal. 
Power up MIPS