Skip to content

BOARDS PROGRAMMING

Revision history

Rev. Department Prepared by Date Revision description
0 iCubFacility D.Tomé 14/12/2014 First Emission
1 icub-tech-iit D.Tomé 31/03/2020 Update for using ST-LINK programmer; added MC4PLUS, MTB4 and STRAIN2 boards
2 icub-tech-iit D.Tomé 20/06/2020 migrated to markdown
3 icub-tech-iit D.Tomé 31/07/2020 added programming procedure for BDC BCB RFE_MASTER boards
4 icub-tech-iit A.Mura 10/05/2021 added programming procedure for BMON boards
5 icub-tech-iit A.Mura 20/06/2022 added programming procedure for BAT boards

1 Document Scope

Info

This procedure shows how to flash Bootloader and Firmware, change the IDs for CAN based boards and assign the IP address for ETH boards.

2 Boards Programming

2.1 EMS4

2.1.1 HW Requiremnts

  • Power Supply 24Vdc @1A
  • MICROFIT3toWIRE (IIT Code 5031.A)
  • EMS-EADP + ETHCROSS (IIT Code 1519.A and 2928.B)
  • ST-LINK/V2 (IIT Code 13499)

2.1.2 SW Requiremnts

  • PC with Windows 10
  • icub-firmware-build repo
  • STM32 ST-LINK Utility installed on the PC
  • FirmwareUpdater tool compiled on your machine (or you can use a pre-configured VM)

2.1.3 Setup connections

  • Connect ST-LINK programmer to the pc and to the P1 connector of EMS4 (4)
  • Connect EMS-EADP to the pc and to the P3 connector of EMS4 using ETHCROSS (5)
  • Connect the power supply to the P12 connector of EMS4 (4)

2.1.4 Flash bootloader and application

  • On the Windows machine go to the icub-firmware-build repo installation folder and browse to icub-firmware-build\ETH\EMS\scripts\st-link
  • Run git pull
  • Set the power supply to 24Vdc@1A and power on
  • Double click on st-link_EMS.bat

2.2 STRAIN2

2.2.1 HW Requiremnts

  • ESD USB-CAN with usb power supply cable. (IIT Code 1014)
  • STRAIN2_ADC Test equipment (IIT Code 12465)
  • ST-Link debugger (IIT Code 13499)
  • STRAIN2 programming Interface (IIT Code 12348) only if needed to reprogramm STRAIN2 incased (mounted)

2.2.2 SW Requiremnts

2.2.3 Setup connections

2.2.3.1 Board programming on pcb
  • Connect ESD CAN-USB (2) and ST-Link (3) to the PC’s USB (1)
  • Connect ESD CAN-USB (2) to the STRAIN2_ADC (4)
  • Connect ST-Link (3) to the STRAIN2_ADC (4)

2.2.3.2 Board programming already mounted inside F/T sensor case
  • Connect ESD CAN-USB (2-A e 2-B) and ST-Link (3-C) to the PC’s USB ports
  • Connect ESD CAN-USB (2) to the STRAIN2_PROG_INT (4)
  • Connect ST-Link (3) to the STRAIN2_PROG_INT (4)
  • Connect STRAIN2 (1) to STRAIN2_PROG_INT (4)

2.2.4 Flash bootloader and application

  • On the Windows machine go to the icub-firmware-build repo installation folder and browse to icub-firmware-build\CAN\strain2\st-link
  • Run git pull
  • Double click on st-link_STRAIN2.bat

2.3 MTB4

2.3.1 HW Requiremnts

  • ESD USB-CAN with usb power supply cable. (IIT Code 1014)
  • MTB4_ADC Test equipment (IIT Code 12603]
  • ST-Link debugger (IIT Code 13499)

2.3.2 SW Requiremnts

2.3.3 Setup connections

  • Connect ESD CAN-USB (2) and ST-Link (3) to the PC’s USB (1)
  • Connect ESD CAN-USB (2) to the MTB4 (MTB4-J1)

2.3.4 Flash bootloader and application

  • On the Windows machine go to the icub-firmware-build repo installation folder and browse to icub-firmware-build\CAN\mtb4\st-link
  • Run git pull
  • Double click on st-link_MTB4.bat

2.4 MC4

2.4.1 HW Requiremnts

  • Power Supply 12Vdc @1A
  • An MCP board (IIT Code 3176)
  • ESD USB-CAN (IIT Code 1014)
  • Code Warrior Programmer USB TAP (IIT Code 361]

2.4.2 SW Requiremnts

2.4.3 Setup connections

  • Connect, with an 8 wires flat cable, one of the four output headers from the MCP board with the P10 header from the MC4 board.
  • Connect the programmer Code Warrior USB TAP with the header P1 on the MC4 board (see Figure 3).
  • Give power to MC4 via MCP by the mean of a 12V power supply.
  • Check that the following LEDs turn on (see Figure 3): a. DL3 = orange b. DL4 = red c. DL5 = green.

2.4.4 Flash bootloader and application

Bootloader
  • Browse to the folder loader56f807 from your local icub-firmware repository.
  • Run git pull
  • Launch CodeWarrior IDE
  • Open the project RM-DownloaderCAN.mcp
  • Press the play icon (debug mode) that loads the BootLoader routines into the MC4 flash memory and run the debug session.

  • When done with the downloading of bootloader routines, you should see the led DL1 (YELLOW) and DL2 (BLUE) turned on for few seconds to indicate that everything went well, afterwards no need to run the debug mode, just stop it by pressing the red cross “STOP” and quit CodeWarriorIDE.
Firmware
  • Connect the USB/CAN to the board
  • Power ON the board
  • In the first 5 seconds click Connect from FirmwareUpdater
  • Go to your icub-firmware-build and do a git pull
  • Select Upload Application and choose the desired firmware version in icub-firmware-build/CAN/4dc

2.5 BLL

2.5.1 HW Requiremnts

  • Power Supply 24Vdc @1A
  • A BLP board (IIT Code 1482.A)
  • ESD USB-CAN (IIT Code 1014)
  • Code Warrior Programmer USB TAP (IIT Code 361]

2.5.2 SW Requiremnts

2.5.3 Setup connections

  • Connect, with flat ribbon cable, the BLP board with the BLL board

Warning

Pay attention to the red cable from the flat ribbon cable (on the top side

  • Give power to BLL via BLP by the mean of a 24Vdc @1A power supply.
  • Connect the programmer Code Warrior USB TAP with the header P1 from the BLL board, and see the leds turn on (DL4, DL5, DL6 and DL7) while led DL1 blinking.

2.5.4 Flash bootloader and application

Bootloader
  • Browse to the folder loader56f807 from your local icub-firmware repository.
  • Run git pull
  • Launch CodeWarrior IDE
  • Open the project RM-DownloaderCAN.mcp
  • Press the play icon (debug mode) that loads the BootLoader routines into the BLL flash memory and run the debug session.
Firmware
  • Connect the USB/CAN to the board
  • Power ON the board
  • In the first 5 seconds click Connect from FirmwareUpdater
  • Go to your icub-firmware-build and do a git pull
  • Select Upload Application and choose the desired firmware version in icub-firmware-build/CAN/2bll

2.6 2FOC

2.6.1 HW Requiremnts

  • Power Supply 30Vdc @1A
  • ESD USB-CAN (IIT Code 1014)
  • Microchip ICD3 (IIT Code 4034]
  • 2FOC Test Setup (IIT code 4569.A)

2.6.2 SW Requiremnts

  • PC with Windows 10
  • icub-firmware repo
  • icub-firmware-build repo
  • MPLAB IDE installed on the PC

2.6.3 Setup connections

Info

Make sure that the following highlighted jumpers are closed

  • Connect the 2FOC test fixture to the 30Vdc @1A power supply
  • Place the 2FOC on the setup

Info

if board mounts heatsink remove all nails highlighted below

  • Connect the ICD3 to the setup
  • Connect the USB/CAN to the board
  • Power on the 2FOC

2.6.4 Flash bootloader and application

Bootloader
  1. Open bootloader MPLAB project at icub-firmware\emBODY\eBcode\arch-dspic\board\any\env\bootloader\proj-bootloader\bootloader.mcw
  2. File->Import then browse to : firmware\emBODY\eBcode\arch-dspic\board\any\env\bootloader\bin\bootloader-2foc.hex
  3. Place the switch SW1 on the setup pointing left side
  4. Click on Erase
  5. Click on Program
  6. Open FirmwareUpdater and click Discover
  7. Change id : 1 (or 3) if SW1 is pointing left (P3 on 2FOC) or 2 (or 4) if SW1 is pointing right (P4 on 2FOC)

Warning

For convention, Id for 2FOC’s P3 must always smaller than the one for P4

  • Move SW1 pointing right and repeat all steps from 4 to 7
Firmware
  • Connect the USB/CAN to the board
  • Power ON the board
  • In the first 5 seconds click Connect from FirmwareUpdater
  • Go to your icub-firmware-build and do a git pull
  • Select Upload Application and choose icub-firmware-build/CAN/2foc/2foc.hex

2.7 MC4PLUS

2.7.1 HW Requiremnts

  • Power Supply 24Vdc @1A
  • ST-LINK/V2 (IIT Code 13499)

2.7.2 SW Requiremnts

  • PC with Windows 10
  • icub-firmware-build repo
  • STM32 ST-LINK Utility installed on the PC
  • FirmwareUpdater tool compiled on your machine (or you can use a pre-configured VM)

2.7.3 Setup connections

  • Connect ST-LINK programmer to the pc and to the P1 connector of MC4PLUS
  • Connect the power supply to the P7 connector of MC4PLUS

2.7.4 Flash bootloader and application

  • On the Windows machine go to the icub-firmware-build repo installation folder and browse to icub-firmware-build\ETH\MC4PLUS\scripts\st-link
  • Run git pull
  • Set the power supply to 24Vdc@1A and power on
  • Double click on st-link_MC4PLUS.bat

2.8 BDC

2.8.1 HW Requiremnts

  • Power Supply 12Vdc @0.5A
  • ST-LINK/V2 (IIT Code 13499)

Warning

Take care to cut off the pin 7 of J1 (Figure 1) and to close the jumper JP1 near R63 (Figure 2)

Figure 1

Figure 2

2.8.2 SW Requiremnts

2.8.3 Setup connections

  • Connect ST-LINK programmer to the pc and to the P1 connector of BDC
  • Connect the power supply to the J2 connector of BDC

2.8.4 Flash bootloader and application

  • On the Windows machine go to the icub-firmware-build repo installation folder and browse to icub-firmware-build\CAN\bdc\st-link
  • Run git pull
  • Set the power supply to 12Vdc @0.5A and power on
  • Double click on st-link_BDC.bat

2.9 RFE_MASTER

2.9.1 HW Requiremnts

  • ST-LINK/V2 (IIT Code 13499)

Warning

Take care to cut off the pin 7 of J8 and close the jumper J7 (Figure 1 -> 1,2)

2.9.2 SW Requiremnts

2.9.3 Setup connections

  • Connect ST-LINK programmer to the pc and to the J8 connector of RFE_MASTER (Figure 1 -> 1)
  • Connect a MICRO-USB cable to J9 connector of RFE_MASTER to power on the board (Figure 1 -> 3)

Figure 1

2.9.4 Flash bootloader and application

  • On the Windows machine go to the icub-firmware-build repo installation folder and browse to icub-firmware-build\CAN\rfe\st-link
  • Run git pull
  • Double click on st-link_RFE.bat

2.10 BCB

2.10.1 HW Requiremnts

  • Power Supply 12Vdc @0.5A
  • ST-LINK/V2 (IIT Code 13499)

Warning

Take care to cut off the pin 7 of J1 (Figure 1)

Figure 1

2.10.2 SW Requiremnts

2.10.3 Setup connections

  • Connect ST-LINK programmer to the pc and to the P1 connector of BCB
  • Connect the power supply to the J3 connector of BCB

2.10.4 Flash bootloader and application

  • On the Windows machine go to the icub-firmware-build repo installation folder and browse to icub-firmware-build\CAN\bcb\st-link
  • Run git pull
  • Set the power supply to 12Vdc @0.5A and power on
  • Double click on st-link_BCB.bat

2.11 BMON

2.11.1 HW Requiremnts

  • Microchip ICD3 programmer
  • No power supply is needed
  • adapter cable ⚠ NOTE: The adapter cable is made with the self-test cable provided with the Microchip ICD3 kit, and the two connectors at the end are not simmetric: cut one and keep the following (color sequence: BLUE - YELLOW - GREEN - RED - BLACK - WHITE from left to right)

At the cut end solder a 2.54mm pitch pin strip, 5 pins (BLACK - WHITE - YELLOW - GREEN - RED, the blue is not connected):

⚠ NOTE: in this configuration, RED wire is the GROUND, and BLACK wire is the 3.3V!

NOTE: remember to solder the transzorb D2 (iitcode 5929) on the dedicated battery pads:

2.11.2 SW Requirements

2.11.3 Setup connections

  • Connect the adapter cable to the Microchip ICD3 programmer, and press the pin strip on the BMON board as shown in the following picture:

2.11.4 Flash bootloader and application

  • Launch MPLAB IDE and open the BMON project:

  • Click on the left menu on PIC12-16F

  • A new window appears; select ICD3, Power in the Option categories menu, check the box Power target circuit from ICD3, and select 3.25 in the Voltage Level menu:

  • To avoid issues due to newer XC8 versions, put these the following two settings in the Project Properties:

  • Click on the following icon to program the board:

  • At the end a Programming/Verify complete message confirms the good programming, and the LD1 red LED on the BMON start to blink:

2.12 BAT

2.12.1 HW Requiremnts

  • Power Supply 12Vdc @0.5A
  • ST-LINK/V2 (IIT Code 13499)

Warning

Take care to cut off the pin 7 of J1 (Figure 1)

Figure 1

2.12.2 SW Requirements

2.12.3 Setup connections

  • Connect ST-LINK programmer to the pc and to the J1 connector of BAT
  • Connect the power supply to the J18 or J19 connectors of BAT (a proper cable is mandatory)

The cable is the following:

2.12.4 Flash bootloader and application

  • On the Windows machine go to the icub-firmware-build repo installation folder and browse to icub-firmware-build\CAN\bat\st-link
  • Run git pull
  • Set the power supply to 12Vdc @0.5A and power on
  • Double click on st-link_BAT.bat
  • Type 1 or 2 to select the firmware target (iCub3 or R1)

3 Boards Common actions

3.1 Change IP Address to ETH boards

Info

This applies to all ETH boards

Warning

If you are using a Linux based OS remember to run in a terminal the following commands to be able to use the ESD USB/CAN device:

sudo ip link set can0 type can bitrate 1000000
sudo ip link set up can0

  • Run FirmwareUpdater -a and select ETH<eth1> in the device list and then click on the Discover button. You should see the board:

  • Now select the board (tick the checkbox) and click on Force ETH Maintenance

  • Now select the board (tick the checkbox) and click on Change IP Address; then set the right IP

  • Click on Set Def Boot eApplication and then on Restart ETH Board(s); wait few seconds then click on Discover (with ETH<eth1> device selected). You should see the board with the new IP address

3.2 Change ID to CAN boards

Info

This applies to all CAN boards

Warning

If you are using a Linux based OS remember to run in a terminal the following commands to be able to use the ESD USB/CAN device:

sudo ip link set can0 type can bitrate 1000000
sudo ip link set up can0

  • Power on the board
  • Run FirmwareUpdater -a and select SOCKETCAN<0> for Linux systems or ESDCAN<0> for Windows; in the device list and then click on the Discover button. You should see the board:
  • Now select the board (tick the checkbox) and click on Change Can Address; then set the right ID