Firmware

From Wiki for iCub and Friends
Revision as of 17:09, 24 July 2014 by Randaz (talk | contribs) (Standard firmware update (DSP))
Jump to: navigation, search


Firmware tools

Firmware upgrade is performed using the CanLoader application.

Standard firmware update (DSP)

The firmware upgrade of the whole robot is performed using a script based on a command line version of the CanLoader module. Before you try to use this script please check that this module is compiled on the pc104. You should also make sure that the hardware modules it needs (controlboard, canmotioncontrol, ecan/pcan/cfw2can) are compiled and liked correctly (this is usually the case on the robot pc104).

Please notice that the firmware upgrade is delicate procedure which changes one of the core parts of the iCub robot software (and therefore requires a corresponding update of the yarp and iCub modules). If you decide to perform a firmware upgrade, be aware that this might change the robot motor behaviour quite a lot. Nevertheless, a firmware upgrade is always recommended because it usually corresponds to improvements in the control board performances. Finally, remember to perform the firmware update with your robot in a 'clean' state (i.e. control boards have been just turned on, and iCubinterface has not run yet).

Here are the steps to perform the firmware update:

  • Connect to the PC104.
  • Go to the $ICUB_ROOT directory and update it (svn update or git pull, depending on your installation)
  • Go to the $ICUB_DIR directoy and recompile the icub-main repository
  • Go to the firmware directory and update it (the firmware directoy is a subfolder of the old svn repository: https://svn.code.sf.net/p/robotcub/code/trunk/iCub/firmware/build)
  • Launch the firmware update script (iCub/firmware/build/updateRobot.sh):

The script retrieves the robot configuration from the firmwareUpdate.txt file which is located in the folder $ICUB_ROOT/app/<the name of your robot>/scripts

When the updateRobot.sh script terminates, a brief report about the firmware update operation is shown on the screen. If all the listed boards have the "ALL OK" tag, then the update was successful. If one or more boards show errors, you can use the CanLoader application in order to check what went wrong, and retry to download the firmware on that particular boards. The CanLoader GUI allows you to check if all the boards have the updated firmware: simply compare the Build number with the most recent build number reported by the ChangeLog file ($ICUB_ROOT/src/firmware/controllerBll/ChangeLog for the type=RM BLL(DSP) boards and $ICUB_ROOT/firmware/controllerBll/ChangeLog for the type=RM 4DC(DSP) boards).

For additional please write an email to: robotcub-hackers@lists.sourceforge.net

Advanced firmware update (DSP)

Alternatively to the complete firmware upgrade procedure described above, you can also create your own custom script which update just a part of the robot, for example:

icub@pc104:ICUB_ROOT/firmware/build$ ./updateRobot.sh updateLegs.txt

The .txt file simply contains a list of board addresses and associated firmware files with the following structure:

[canModule] [canDeviceNum] [boardId] [firmware]

where:

  • canModule can be either pcan (if you are using the PLX custom board) or ecan (if you are using the commercial usb to can interface produced by ESD) or cfw2can (if you are using the custom CFW2 board).
  • canDeviceNum is the CAN line identifier (i.e: 0 for the head, 1 for the left arm, 2 for the right arm, etc..)
  • boardID is the board address (0...14) on the selected CAN line.
  • firmware is the firmware binary file (*.s for motorola-based boards, *.hex for DSPIC-based board).

Firmware update (Force/Torque Sensors)

In this section is described the procedure to update the firmware of the F/T sensors. iCub (version >=1.1) is equipped with four F/T sensors, one for each limb, connected to the CanBus. For a complete reference of the used CAN bus addresses please refer to: list of the CAN bus addresses

Procedure for updating the firmware of the F/T Sensors

The update of the F/T sensors firmware is performed using the CanLoader module. The procedure is identical to the standard procedure used to update the firmware of a single DSP board:

  • open the CanLoader GUI.
  • select the can bus number and the can bus device driver from the menus and click 'Connect'.
  • select the F/T sensor (click on the checkbox on the left).
  • select the firmware file from the file selector on the right (default location: iCub\src\firmware\build\strain.hex).
  • click 'Start Download'.

ft_update1

Note: A command-line procedure is also provided. To update the firmware, run the following command:

canLoader20 --canDeviceType <t> --canDeviceNum <x> --boardId <y> --firmware <f>

where:

  • parameter <t> is the name of the CAN bus driver. It can be ecan or pcan or cfw2can
  • parameter <x> is the number of the CAN bus (0-9)
  • parameter <y> is the CAN address of the F/T sensor (0-15)
  • parameter <f> is the firmware binary file (e.g. strain.hex)

Reset of the F/T Sensors

Note: This procedure completely erases both the flash and the eeprom of the F/T Sensor. You will have to download again the calibration data in the sensor after performing the reset of the F/T sensor. It's most likely that you DO NOT have to follow this procedure, unless some serious problem occurred. Even if you downloaded a wrong firmware file in the F/T sensors, only the standard procedure described above is needed to update it.

The procedure to reset a F/T Sensor is the following:

  • open the CanLoader GUI.
  • select the can bus number and the can bus device driver from the menus and click 'Connect'.
  • select the F/T sensor (click on the checkbox on the left).
  • check the eeprom box on the right.
  • select the firmware file from the file selector on the right (default location: iCub\src\firmware\build\strain.hex).
  • click 'Start Download'.

After the completion of the firmware download:

  • reboot the F/T sensor (remove the power supply, restart the sensor, reconnect the Can Loader GUI, waiting for the boot time (10 seconds).
  • after the reset, the CAN address of the sensor will be changed to 15. Change it by clicking on the number in the Can Loader GUI. The new address is automatically saved in the sensor eeprom.
  • download a the correspoding sensor calibration data.

Note: Remember: do not erase the F/T sensor eeprom, unless you are really sure what you are going to do or you were instructed to do so. ft_update2

Import of the calibration data

This procedure is used to download the calibration data in the F/T sensors eeprom. Since iCub mounts calibrated F/T sensors, you don't need to follow this procedure, unless you intentionally erased the sensor eeprom. (even if you flash a new firmware update, you do not need to redownload the calibration data because they are kept in eeprom memory)

The procedure to import the calibration data is identical to the standard firmware update, just select a calibration file (calibrationDataSN*.dat) instead of a firmware file (strain.hex).

  • open the CanLoader GUI.
  • select the can bus number and the can bus device driver from the menus and click 'Connect'.
  • select the F/T sensor (click on the checkbox on the left).
  • select the calibration file from the file selector on the right (default location: iCub\app\<robot name>\conf\calibration\ftSensor\<robot part>\calibrationDataSN*.dat).
  • click 'Start Download'. The software automatically distinguish a calibration data file from a firmware binary file. The calibration data are automatically saved in the eeprom.

Note: A command-line procedure is also provided. To update the firmware, run the following command:

canLoader20 --canDeviceType <t> --canDeviceNum <x> --boardId <y> --calibration <f>

where:

  • parameter <t> is the name of the CAN bus driver. It can be ecan or pcan or cfw2can
  • parameter <x> is the number of the CAN bus (0-9)
  • parameter <y> is the CAN address of the F/T sensor (0-15)
  • parameter <f> is the calibration data file (e.g calibrationDataSN020.dat)

Current files version for F/T Sensors

File type Location Last version
firmware file iCub\src\firmware\build\strain.hex 2.3.6
calibration data file iCub\app\<robot name>\conf\calibration\ftSensor\<robot part>\calibrationDataSN*.dat 2

Firmware versions

A complete description of the different firmware versions used by the DSP boards which control the iCub robot can be found here.

Additional notes:

Bootloader update

To update the bootloader you must have a programmer for Freescale DSP56F807 (USBTAP or a ParallelToJTAG programmer), CodeWarrior IDE that you can download from the http://www.freescale.com (the code of the bootloader is small then it is not required any license) and the CanLoader module. In order to see the bootloader version of the boards you must run the CanLoader module in gui mode and press the connect button within five seconds after switching on the boards. Information on where and what to buy from Freescale (Metrowerks CodeWarrior) can be found in here.

There is also a document describing the firmware versions available from here

How to upload the bootloader step by step.

  • Connect the JTAG to the connector P1 of the BLL or MC4 board. If you have to remove screws to do it, you have to put them in the same place after installing the bootloader. The pinout of the connector is the following:


JTAG pinout in BLL and 4DC

Connector P1 Label
1 TDI
2 TDO
3 GND
4 TCK
5 ~RESET
6 TMS
7 3.3V
8 ~DE
9 ~TRST
10 ~RSTO


  • Run CodeWarrior IDE and open the project $ICUB_ROOT$/firmware/loader56f807/RM-DownLoaderCAN.mcp
  • Go to Edit -> 56807 BootLoader Setting and set the programmer you are using. In the case of the USBTAP this is the setting:

bootloader

  • Switch on the board
  • Press the play button on the project tab and wait until the download is completed. It will take less then one minute.
  • Now you must restart the board and download the right firmware using the CanLoader application in gui mode. Note: You must download the firmware immediately after (from one to 5 seconds) the board is switched on . So, you have to switch on the board and then press the connect button in the canLoader gui.

Bug report

Bugs should be reported on the mailing list robotcub-hackers@lists.sourceforge.net