Overview
This page describes installation of software updates. You may also follow these instructions to restore the P3 SD card to its original state if the contents become corrupted so that your MIRO will no longer boot.
MIRO ships with firmware already installed—unless you are intending to update the software, you do not need to follow the instructions on this page.
These instructions return your
SD card to factory condition—please take note that this will
delete any user data on the card irretrievably.
The procedures described here will erase the contents of a drive—please ensure that your
workstation is backed-up before proceeding since a software or user error may cause loss of data.
To discover what software is currently installed on your MIRO, login to P3 and execute miro_maint info
.
Install MDK
Obtain the latest MDK (Complete Edition) from this page. Unpack the MDK on your workstation and link the top-level directory of the release to the directory ~/mdk
, as shown below.
Note that the example release tag "170423" should be replaced, in the commands below, with the tag of the release you are installing.
If you have an existing MDK installed at
~/mdk
, you can either rename it, or use a different name for the new updated release.
$ tar xvf mdk-170423.tgz
mdk-170423/
...
$ cd mdk-170423
$ ln -s $PWD ~/mdk
See Prepare workstation for more details on the MDK installation process.
Reprogram P3
You can use any micro-SD card of at least 4GB in size with MIRO; MIRO ships with a suitable card, but you might usefully maintain multiple cards with different configurations.
P3 card programming options
Before we program the card, we need to choose an options string to pass to the programmer. Concatenate the options below, as required. See also Additional P3 card programming options.
Root password
Set a custom root password using the option string --pass=<password>
. If you do not use this option, you should change the root password when you first connect your MIRO to your network, for security.
Please note that not changing the default root password may pose a security risk to your network.
Network credentials
You can provide network credentials after booting using MIROapp. However, you may prefer to provide them during card-programming, using option string --network=<ssid>/<passphrase>
(e.g. --network=my_ssid/my_passphrase
).
Network configuration
If you plan to run software, including the ROS master node, on-board MIRO, you do not need to pass an option. If, instead, you want your robot to communicate with a ROS master on a remote machine, you need to provide the IP address of that remote machine, using --masteraddr=<address>
. Alternatively you can provide the ROS master address using MIROapp.
Program
To program the SD card, you will plug it into a card reader attached to your workstation. The card will appear with some physical device name under /dev
, and you need to obtain this device name to proceed.
One way to obtain the device name is to open a terminal and enter
ls /dev/sd* | grep -v [0-9]
at the command prompt before and after plugging in your card reader; your card is the device name that appears.
Another way is to run
dmesg | tail
after plugging in the device—the last few lines will indicate the physical device name (something like "sdf", which would correspond to the device
/dev/sdf
).
Alternatively, try
lsblk
before and after plugging in your device.
Navigate to the bin
folder in the MDK and proceed as follows to program the card. There is a safety check to reduce the chance of erasing the wrong device—the first time you program a card, you must start with it unplugged, and plug it in only when you are prompted to do so, or programming will not proceed.
You can put the options you chose, above, on the end of your command line, as shown below.
$ cd ~/mdk/bin/deb64
$ sudo ./program_P3.sh <device name> <your option string>
...
check that file system <device name> is absent...
OK!
please plug in device, wait a moment, and then press a key...
...
By way of example, the programming line we use here is shown below. NB that your option line will very probably be different!
$ cd ~/mdk/bin/deb64
$ sudo ./program_P3.sh /dev/sdf --pass=XXXXXXXX --network=mironet/miropass --masteraddr=192.168.1.100
...
Programming will now proceed, with some information along the way to let you know what's happening. If all goes well, the final step will be to unmount the card so that you can remove it from the card reader and plug it back into MIRO.
...
(unmount)...
(sync)...
OK!
On subsequent attempts to program the same card, the programming tool will recognise that the card has a MIRO system on it already and the safety check will be skipped (i.e. programming will proceed even if your card is already plugged in when you start the programmer). Please note that this will not protect any data you have stored on the card alongside the MIRO system—this will be erased if you reprogram the card.
Reboot
Once reprogramming is complete, install the new card in MIRO and turn your MIRO on. MIRO will perform First Boot automatically, which takes just a few seconds, and will shortly be ready to use as normal.
Reprogram P2
The updated P3 system includes the firmware image for P2. If this is to be updated also (you only need to do this if you are updating to a different software version in P3), you should start by updating P3, as described above, and then login to P3 as normal, proceeding as follows to update P2 firmware.
$ cd ~/mdk/bin/am335x
$ ./program_P2.sh main
programming ../../image/P2/P2_main.bin to sector 1...
________________________________________________________________
MIRO tools [miro_maint]
Copyright (C) 2019 Consequential Robotics
________________________________________________________________
target: P2
mode: USB
device: /dev/P2
operation: WRITE
________________________________________________________________
[000.000] enter/confirm maint mode...
[000.000] MIRO_MAINT_OP_NOP... [NO RESPONSE]
[000.271] MIRO_MAINT_OP_NOP... [NO RESPONSE]
[001.281] MIRO_MAINT_OP_NOP... [OK]
[001.534] MIRO_MAINT_OP_HANDSHAKE... [OK]
________________________________________________________________
[001.537] erase FLASH_WRITE_OK...
[001.537] length: 4 (padded to block boundary at 256)
[001.538] MIRO_MAINT_ERASE: 0xf0000... [OK]
[001.978] MIRO_MAINT_WRITE.... [OK]
________________________________________________________________
[001.981] write main...
[001.981] READ: "../../image/P2/P2_main.bin"
[002.001] length: 160304 (padded to block boundary at 160512)
[002.002] MIRO_MAINT_ERASE: 0x10000... [OK]
[002.429] MIRO_MAINT_ERASE: 0x20000... [OK]
[002.864] MIRO_MAINT_ERASE: 0x30000... [OK]
[003.306] MIRO_MAINT_WRITE......................................
................................................................
................................................................
................................................................
................................................................
................................................................
................................................................
................................................................
................................................................
................................................................
................ [OK]
________________________________________________________________
[005.176] reinstate FLASH_WRITE_OK...
[005.176] length: 4 (padded to block boundary at 256)
[005.176] MIRO_MAINT_ERASE: 0xf0000... [OK]
[005.610] MIRO_MAINT_WRITE.... [OK]
________________________________________________________________
[005.613] MIRO_MAINT_OP_RESET... [OK]
________________________________________________________________
**** SUCCESS ****
It is normal to see some warnings during startup of communications with the platform; therefore, seeing some warnings during programming does not necessarily indicate a problem.
If the ERASE phase succeeds but the WRITE phase fails mid-way, it may succeed if you try again.
If WRITE fails repeatedly and consistently, ensure the batteries are fully charged and try again.