Skip to content
Karl Palsson edited this page Feb 23, 2016 · 13 revisions

ONLINE Manual Update (via WeIO IDE program)

If from any reason standard IDE "Update" button don't work, it's possible to update WeIO to the newest version using the following script directly from WeIO IDE interface, as a usual WeIO program. Your WeIO board needs to be connected to the Internet in order to correctly do it's update.

This script will download the latest version of WeIO software and then start upgrade by completely replacing the old one. All your projects and configuration of WeIO board WILL BE preserved by this method. However we are suggesting that you do backup before doing update.

  • Open WeIO IDE and make sure that your board is connected to the Internet.
  • Click on the project > Create new project to create a new one
  • Inside main.py file copy paste this script and run it
  • Be patient, update can be long (up to 5min)
  • Wait until update process is finished (bootloader will pick new FW and write it into the flash).
  • You will see new Linux booting and blinking the LEDs
  • When only AP or STA led is lit - boot is finished and WeIO is up
  • Enjoy brand new WeIO :)
from weioLib.weio import *
import urllib, os, subprocess

def setup():
    attach.process(myProcess)
    
def myProcess():
    print("Hello world")
    url = "http://we-io.net/downloads/update/bundle/updateRecipe"
    response = urllib.urlopen(url)
    data = response.read()
    filename = "/tmp/updateRecipe"
    f = open(filename, 'w')
    f.write(data)
    f.close()
    os.chmod(filename, 0755)
    print "Updater will now install the newest WeIO firmware"
    print "Please don't touch a thing, this procedure can be long (up to 5min)"
    print "Wait until LED blinking stops at one LED and stays still"
    print "If you turn off the power you can easily brick your board\n\n"

    print "Update will start in :"    
    for a in range(20):
        print 20-a, "s"
        delay(1000)

    p = subprocess.call(filename)

OFFLINE Manual Update (via SD card or USB key)

Sometimes we might find ourselves with unusable board. This can be for several reasons:

  • Update that did not finished correctly
  • Some installations that broke something into the system
  • ...

In order to recover WeIO board to working version, we implemented mechanism of WeIO Recovery.

This mechanism takes WeIO FW in binary form from external storage and replaces (destructivly) all current SW on WeIO with it.

N.B. Back up all your projects before executing WeIO Recovery

Procedure is following:

  • Get weio_recovery.bin from latest release (for example here: https://github.com/nodesign/weio/releases/)
  • Put this binary on SD card or USB key
  • Unplug power from WeIO
  • Plug SD card / USBkey to WeIO
  • Press and hold SOFT RESET button on WeIO
  • Plug power to WeIO while keeping the SOFT RESET button pressed
  • You will see STA led blink 3 times
  • Now you can release the SOFT RESET BUTTON
  • Wait until update process is finished (bootloader will pick new FW and write it into the flash)
  • You will see new Linux booting and blinking the LEDs
  • When only AP led is lit - boot is finished and WeIO is up

N.B. currently there is bug in the WeIO that demands one reboot after WeIO Recovery for WeIO to function correctly.

To explain a bit this procedure for the people who would like to know how this works:

  • There is a U-Boot booatloader (http://www.denx.de/wiki/U-Boot) on the board that loads Linux from NOR flash (internal non-volatile memory of the Carambola 2 HW module on WeIO board) in the normal case.
  • In the special case (when SOFT RESET button is held on power-on) U-Boot will scan all external storage for the binary named weio_recovery.bin
  • If this bianry is found, it will load it in RAM from external storage, then erase current system from internal flash and then write new form RAM into the flash
  • Then u-boot will reset the board and boot in the normal way, loading Linux from flash - but this time there will be new system image (this one that was just written previously)

Known Problems

In some cases, the recovery mode crashes. I had this problem once, with the USB flash I always use. So I don't think this is related to the device used. Once the problem appears for the first time, it's impossible to perform the recovery automatically.

Fortunately, the situation is not desperate !

For those who have some trouble with the recovery mode, and especially if serial console shows a strange message, like the one below, here's how to recover the board.

** Unrecognized filesystem type **
start 284170288 size -195638799 name r`ó¬0òqÐðÓðpr762À±ràüô²ÒýÄòÒó¶é·Ó|ÆMTðyá’þxÀp´•¶h¶ðüñx¸qpæu°¹ñ©pÓôÀ0pÁ¨Ó°>HAä¼uxrþðR°ýÌa¸ÓuÀ×ùè½×~]TàQqxÄÀ`ñqðôù|“ûpÒúaòàGpPã°ñ9ôØ¢ÔòÐlÐð°ØÕh

First, you must be able to display the serial console. The serial console is accessible via RS232, at 115200 bauds. From my side, I use screen, which work well both for Linux and OSX. For Windows users, hyper terminal or putty will do the job.

Once connected via RS232 to the board, you'll probably see the strange message above. If it's the case, follow these instructions :

  1. Format a USB flash drive (FAT32)
  2. Download the latest weio_recovery.bin file from here
  3. Copy weio_recovery.bin on the usb flash drive
  4. Plug the flash drive in Weio
  5. Connect to the debug console via RS232
  6. Press the RST switch located between 3V3 and SDA pin : the CPU will reset
  7. When the system boots (ie when the message U-Boot 1.1.4-gee517e1a (Nov 4 2014 - 13:53:19) is displayed), press ESC to enter u-boot
  8. You'll see the following message :
    Hit '<ESC>' key(s) to stop autoboot:  0 
    ar7240>
  9. Type the following commands (BE CAREFUL when you type the commands. If address are wrong, you may erase all the flash content, included u-boot. In this case, the board will be definitively bricked ! Please read carefully the following, and don't do anything if you're not sure of your command. Ask me if you have questions ;) )
ar7240> usb start
ar7240> usb storage
  Device 0: Vendor: Generic  Rev: 1.76 Prod: Ultra HS-SD/MMC
            Type: Removable Hard Disk
            Capacity: not available
  Device 1: Vendor: General  Rev: 1100 Prod: USB Flash Disk  
            Type: Removable Hard Disk
            Capacity: 30762.0 MB = 30.0 GB (63000576 x 512)

USB Flash Disk is detected device in this case, located at Device 1 (but it can be enumerated differently in some pother case - for example Device 0)

ar7240> fatls usb 1:1
 13434884   weio_recovery.bin 

1 file(s), 0 dir(s)

fatls shows weio_recovery.bin

ar7240> erase 0x9f050000 +0xd90000
.........................................................................................................................................................................................................................

All the flash is now erased.

ar7240> fatload usb 1:1 0x80050000 weio_recovery.bin
reading weio_recovery.bin
13434884 bytes read in 77800703 ms ( 0 kB/s)

Read weio_recovery.bin from the USB flash drive. The ${filesize} variable is automatically expanded by uboot to match the file read with "fatload"

ar7240> cp.b 0x80050000 0x9f050000 ${filesize}
Copy to Flash... .............................................................................................................................................................................................................done

This command copy the file in the flash memory. All is now done. Just type the command boot.

The system should now boot without any problem.