2017年5月28日 星期日

Arduino Yun - 原廠復位方法


復位方式一 - 按鈕

按住 YUN RST 30 秒,會自動復位到 AP Client 模式。


復位方式二 - 終端機復位

下載程式碼或以下: https://www.arduino.cc/en/Tutorial/YunSerialTerminal

/*
  Arduino Yún USB-to-Serial

  Allows you to use the YunShield/Yún processor as a
  serial terminal for the Linux side on the Yún.

  Upload this to a YunShield/Yún via serial (not WiFi) then open
  the serial monitor at 115200 to see the boot process of Linux.
  You can also use the serial monitor as a basic command line
  interface for Linux using this sketch.

  From the serial monitor the following commands can be issued:

  '~' followed by '0' -> Set the UART speed to 57600 baud
  '~' followed by '1' -> Set the UART speed to 115200 baud
  '~' followed by '2' -> Set the UART speed to 250000 baud
  '~' followed by '3' -> Set the UART speed to 500000 baud
  '~' followed by '~' -> Sends the bridge's shutdown command to
                        obtain the console.

  The circuit:
   YunShield/Yún

  created March 2013
  by Massimo Banzi
  modified by Cristian Maglie

  This example code is in the public domain.

  http://www.arduino.cc/en/Tutorial/YunSerialTerminal

*/

long linuxBaud = 250000;

void setup() {
  SERIAL_PORT_USBVIRTUAL.begin(115200);  // open serial connection via USB-Serial
  SERIAL_PORT_HARDWARE.begin(linuxBaud); // open serial connection to Linux
}

boolean commandMode = false;

void loop() {
  // copy from USB-CDC to UART
  int c = SERIAL_PORT_USBVIRTUAL.read();    // read from USB-CDC
  if (c != -1) {                            // got anything?
    if (commandMode == false) {             // if we aren't in command mode...
      if (c == '~') {                       //    Tilde '~' key pressed?
        commandMode = true;                 //       enter in command mode
      } else {
        SERIAL_PORT_HARDWARE.write(c);      //    otherwise write char to UART
      }
    } else {                                // if we are in command mode...
      if (c == '0') {                       //     '0' key pressed?
        SERIAL_PORT_HARDWARE.begin(57600);  //        set speed to 57600
        SERIAL_PORT_USBVIRTUAL.println("Speed set to 57600");
      } else if (c == '1') {                //     '1' key pressed?
        SERIAL_PORT_HARDWARE.begin(115200); //        set speed to 115200
        SERIAL_PORT_USBVIRTUAL.println("Speed set to 115200");
      } else if (c == '2') {                //     '2' key pressed?
        SERIAL_PORT_HARDWARE.begin(250000); //        set speed to 250000
        SERIAL_PORT_USBVIRTUAL.println("Speed set to 250000");
      } else if (c == '3') {                //     '3' key pressed?
        SERIAL_PORT_HARDWARE.begin(500000); //        set speed to 500000
        SERIAL_PORT_USBVIRTUAL.println("Speed set to 500000");
      } else if (c == '~') {                //     '~` key pressed?
        SERIAL_PORT_HARDWARE.write((uint8_t *)"\xff\0\0\x05XXXXX\x7f\xf9", 11); // send "bridge shutdown" command
        SERIAL_PORT_USBVIRTUAL.println("Sending bridge's shutdown command");
      } else {                              //     any other key pressed?
        SERIAL_PORT_HARDWARE.write('~');    //        write '~' to UART
        SERIAL_PORT_HARDWARE.write(c);      //        write char to UART
      }
      commandMode = false;                  //     in all cases exit from command mode
    }
  }

  // copy from UART to USB-CDC
  c = SERIAL_PORT_HARDWARE.read();          // read from UART
  if (c != -1) {                            // got anything?
    SERIAL_PORT_USBVIRTUAL.write(c);        //    write to USB-CDC
  }
}

燒錄後,Serial Monitor 開著,按一下 YUN RST 重開機。

在終端機就可以下指令:

reset-to-factory-anyway
reboot

復位方式三 - Kernel 重刷

如果開機時出現:

[    4.460000] Kernel panic - not syncing: Attempted to kill init!

代表 Kernel 有問題,在開機時先隨便輸入文字讓它啟動開機前的模式,並按照下方法操作:

https://www.arduino.cc/en/Tutorial/YunUBootReflash

*使用這個方法請注意,不要突然關機或是拔掉電源,沒有網路可能是你的 dhcp 位置是 192.168.1.x 但實際上區域網路是 192.168.2.x,修正 setenv serverip 和 ipaddress 就好了,不要重刷系統。 (不慎失敗,你就只能用 arduino uno 相同的功能了。)

Reference:
https://www.arduino.cc/en/Tutorial/YunUBootReflash
http://www.linuxquestions.org/questions/linux-embedded-and-single-board-computer-78/kernel-panic-not-syncing-attempted-to-kill-init-897244/
http://forum.arduino.cc/index.php?topic=195589.0
https://forum.arduino.cc/index.php?topic=429400.0
https://www.element14.com/community/community/arduino/blog/2015/04/18/three-ways-to-reflash-an-arduino-yun
http://www.e-ampm.com/?p=1772
https://justjii-justdrink.rhcloud.com/archives/118
http://forum.arduino.cc/index.php?topic=214750.0
https://forum.arduino.cc/index.php?topic=190129.0
https://www.element14.com/community/community/arduino/blog/2015/04/18/three-ways-to-reflash-an-arduino-yun
http://www.ibuyopenwrt.com/index.php/8-yun-compatible/104-reset-to-factory-settings
http://playground.arduino.cc/Hardware/Yun
https://www.arduino.cc/en/Tutorial/YunSerialTerminal
http://yehnan.blogspot.tw/2013/10/arduino-yun.html
https://forum.arduino.cc/index.php?topic=227213.0
http://forum.arduino.cc/index.php?topic=195589.0
http://www.ibuyopenwrt.com/index.php/11-yun-compatible/expand-the-storage-at-yun/22-revert-boot-to-internal-flash
http://www.ibuyopenwrt.com/index.php/8-yun-compatible/104-reset-to-factory-settings
http://forum.arduino.cc/index.php?topic=325056.0
http://www.ibuyopenwrt.com/index.php/8-yun-compatible/104-reset-to-factory-settings
https://www.youtube.com/watch?v=vt9C-hMa1Ok
http://forum.arduino.cc//index.php?topic=192869.0
http://forum.arduino.cc/index.php?topic=325056.0
http://forum.arduino.cc//index.php?topic=193038.msg1426864#msg1426864
https://forum.arduino.cc/index.php?topic=190129.0


沒有留言:

張貼留言

© Mac Taylor, 歡迎自由轉貼。
Background Email Pattern by Toby Elliott
Since 2014