Skip to content

2FOC

Revision history

Rev. Dep Prepared by Date Revision description
0 EDL A. Merello 21/3/2012 First Emission
1 icub-tech J. Losi 05/06/2025 Add steps for closing fault and CAN bridges
2 icub-tech J. Losi 02/07/2025 Revised instructions and hw requirements, then removed used step that use oscilloscope

1 Document Scope

Info

This procedure shows how to test 2FOC electronic boards and applies to the following IIT code:

  • 3336, 2FOC, IIT - Electronic board with CAN interface, dual driver for brushless motors, power supply 18-48V, 20A full Band width, for iCub, new heatsink
  • 3336, 2FOC rev.K, IIT - Electronic board with CAN interface, dual driver for brushless motors, power supply 18-48V, 20A full Band width, for iCub, TMCS1100A2 and 31A overcurrent

2 Requirements

2.1 Hardware Requirements

  • Any regulated 45V power supply with current regulation from 200mA to 2A with current reading.
  • Digital multimeter 1% or better accuracy.
  • 2FOC_ADC, IIT - Testing equipment for 2FOC boards (IIT-Cod.4569.D)
  • CAN bus interface ESD USB-CAN C.2066.02 (IIT-Cod.1014)
  • The 2FOC Test JIG and its cables and accessories (power supply cables, CAN cable, passive loads, etc)
  • The cables and resistive loads for testing phase 2.
  • PICkit™ 4 In-Circuit Debugger/Programmer for Microchip PIC and dsPIC Flash Microcontrollers (IIT-Cod.16721)
  • Equivalently the procedure allows to flash the microcontroller of the board with the PICkit™ 3 In-Circuit Debugger/Programmer for Microchip PIC and dsPIC Flash Microcontrollers (IIT-Cod.13068)

2.2 Software Requirements

  • The software package for 2FOC test (the whole package is installed through 2FOC-Setup.exe). Choose the correct one from the desired ETS release version.
  • A PC with at least two USB ports and Windows 10.

3 Test Procedure

Warning

Handle the test setup taking care to not break thin wires and connectors.

3.1 Installing ETS test suite

Before any 2FOC board can be tested, the test software must be installed on the PC. In order to do this, it is enough to run 2FOC-Setup.exe and to follow the instructions that will be shown on the screen. During the installation the Microchip MPLAB IDE will be also installed. Please do not change the default destination folder. You can skip (cancel) the MPLAB installation if a recent MPLAB ( version >= 8.46 ) is installed in the default destination folder on the PC. If the following screen appears during the installation of MPLAB, it is safe to click “ignore”

Once the installation process has completed the test suite package is available in a folder named by default as 2FOCTEST. The user interface can be start by running the application testUI.exe present in the installation folder.

Note

Since driver related problems has been experience with the ESD USB-CAN device, the application package installed contains a folder name drivers_can where all types of drivers for the device are present. Thus, if any driver problem is encountered, one can update the driver for the device in the Device Manager in Winodws by passing that folder to the update wizard.

3.2 UI Brief Description

The EDL Test Suite UI is divided into four parts. On the right a log box shows messages containing information about what is happening and which operations have been performed.

  • The left part of the main window is divided into two sections. In the upper part the tests belonging to the normal test sequence are listed (they can be for example disabled or selected).
  • In the lower part the manual tests are listed. Those tests are not normally performed, but they can be useful to perform further investigation when something in the main test sequence goes wrong.
  • In the bottom part of the window there are some buttons that can be used to control the program: Clicking the button “RUN TEST SEQUENCE” will run the full test sequence. Once it is completed a report will be produced.
  • It is also possible to run single tests by selecting a test in the left part of the window and clicking the button “Run Selected”.
  • The “Loop” checkbox can be used to force the test to be repeated continuously. Doing this on tests that involves current flowing into the resistive loads can result in an excessive overheating of the resistive loads.

3.3 Test Procedure

The 2FOC test procedure is done in two phases. For each of the phases the user gets prompted to choose the correct CAN line to used. By default this is the line CAN0 and if nothing gets changed on the Windows Device Driver it will always be that one.

Phase 1

It's performed with the aid of the test JIG, when the 2FOC board is fully assembled except for terminal blocks and MOSFETs. In this phase the MOSFETs on the test JIG are used in order to test the 2FOC board. Connection to these MOSFETs and to the power rail is achieved by some needles on the JIG. The JIG should be prepared as in the following image.

Once all the needles are places as shown, it is possible to place the board (without THT components and MOSFETs ) on top of them, ready to go through the first validation phase. The JIG also contains passive loads (resistors) required to perform the tests. The bootloader and the test firmware are also programmed on the two microcontrollers using PcKit3/PcKit4 programmer and CAN bus respectively. The programmer interfaces with the micros by some smaller needles placed on the 2FOC-AdC, which should never be removed. In order to perform phase 1 tests, it is required to load the “fase1.xml” configuration file in the test software. This can be easily done selecting “open” in the “file” menu.

Phase 1 tests brief description
• “preparazione scheda”: This is not really a test, but it describes all the operations required in order to prepare the DUT for testing (cables connection and insertion into the test JIG).
• “terminazione CAN”: This test is needed in order to check if the CAN bus termination resistors on the DUT are correctly installed (when required)
• “test assorbimento”: The DUT current consumption is checked to detect DUT power circuit major failures or DUT power lines shorts.
• “Test presenza 5V su connettori laterali”: This test is performed to check if the DUT is able to generate the required power on the external accessory connectors.
• “test MCLR”: This is the MCUs reset signal, it must be stable to ensure proper DUT operation.
• “test tensioni di alimentazione”: In this test all the DUT generated power supplies are checked for proper voltage.
• “Flash bootloader canale 2”: the JTAG operation for MCU #2 is checked and the bootloader is flashed in the internal MCU #2 memory
• “Flash bootloader canale 1”: the JTAG operation for MCU #1 is checked and the bootloader is flashed in the internal MCU #1 memory
• “FW CAN update canale 1”: the CAN bus operation for MCU #1 is checked and the test firmware is upload on the DUT memory
• “FW CAN update canale 2”: the CAN bus operation for MCU #2 is checked and the test firmware is upload on the DUT memory
• “Verifica FW collaudo canale 1”: This test verifies the presence and aliveness of the (correct version of) test firmware on MCU #1
• “Verifica FW collaudo canale 2”: This test verifies the presence and aliveness of the (correct version of) test firmware on MCU #2
• “Verifica versione HW canale 1”: The HW revision string reported by the MCU #1 is checked. Currently this value is hardcoded in the firmware. Hardware detection mechanisms are not implemented yet
• “Verifica versione HW canale 2”: The HW revision string reported by the MCU #2 is checked. Currently this value is hardcoded in the firmware. Hardware detection mechanisms are not implemented yet
• “Verifica revisione silicio canale 1”: The MCU #1 silicon revision is checked. Some old MCUs are not compatible with the application and they should not pass this test.
• “Verifica revisione silicio canale 2”: The MCU #2 silicon revision is checked. Some old MCUs are not compatible with the application and they should not pass this test.
• “test lettura ADC VDC 18V CH 1”: This tests the MCU #1 power rail ADC measurement with 18V power supply
• “test lettura ADC VDC 18V CH 2”: This tests the MCU #2 power rail ADC measurement with 18V power supply
• “test lettura ADC VDC 36V CH 1”: This tests the MCU #1 power rail ADC measurement with 36V power supply
• “test lettura ADC VDC 36V CH 2”: This tests the MCU #2 power rail ADC measurement with 36V power supply
• “TEST LED canale 1”: The two LEDs connected to MCU #1 operation is checked.
• “TEST LED canale 2”: The two LEDs connected to MCU #1 operation is checked.
• “TEST corto su segnali P1 CH1”: The external connector P1 is tested in order to detect shorts on its signals.
• “TEST corto su segnali P2 CH1”: The external connector P2 is tested in order to detect shorts on its signals.
• “TEST corto su segnali P6 CH2”: The external connector P6 is tested in order to detect shorts on its signals.
• “TEST corto su segnali P5 CH2”: The external connector P5 is tested in order to detect shorts on its signals.
• “TEST loop su segnali P1 CH1”: The external connector P1 is tested in order to ensure proper electric connection of its signals.
• “TEST loop su segnali P2 CH1”: The external connector P2 is tested in order to ensure proper electric connection of its signals.
• “TEST loop su segnali P6 CH2”: The external connector P6 is tested in order to ensure proper electric connection of its signals.
• “TEST loop su segnali P5 CH2”: The external connector P5 is tested in order to ensure proper electric connection of its signals.
• “test fault a riposo su CH1”: The MCU #1 overcurrent detection circuit output is verified when the current is not flowing on the loads
• “test fault a riposo su CH2”: The MCU #2 overcurrent detection circuit output is verified when the current is not flowing on the loads
• “test lettura ADC fase 1 CH1”:  the MCU #1 current reading circuit on motor phase 1 is checked. 
• “test lettura ADC fase 2 CH1”: the MCU #1 current reading circuit on motor phase 2 is checked. 
• “test lettura ADC fase 1 CH2”: the MCU #2 current reading circuit on motor phase 1 is checked. 
• “test lettura ADC fase 2 CH2”: the MCU #2 current reading circuit on motor phase 2 is checked. 
• “test pull-down PWM CH1”: the pull-down resistors presence on the PWM MCU #1 output signals is checked
• “test pull-down PWM CH2”: the pull-down resistors presence on the PWM MCU #2 output signals is checked
• “test short ponte CH 1 fase X”: This test detects if due to some malfunction one of the two MOSFETs on the X motor phase (MCU #1) is wrongly driven “closed”.
• “test short ponte CH 1 fase Y”: This test detects if due to some malfunction one of the two MOSFETs on the Y motor phase (MCU #1) is wrongly driven “closed”.
• “test short ponte CH 1 fase Z”: This test detects if due to some malfunction one of the two MOSFETs on the Z motor phase (MCU #1) is wrongly driven “closed”.
• “test short ponte CH 2 fase X”: This test detects if due to some malfunction one of the two MOSFETs on the X motor phase (MCU #2) is wrongly driven “closed”.
• “test short ponte CH 2 fase Y”: This test detects if due to some malfunction one of the two MOSFETs on the Y motor phase (MCU #2) is wrongly driven “closed”.
• “test short ponte CH 2 fase Z”: This test detects if due to some malfunction one of the two MOSFETs on the Z motor phase (MCU #2) is wrongly driven “closed”.
• “Test I su ponte CH1”: this test causes a certain amount of current to flow in the load through the MOSFETs, reads back the current measurement and verifies the value is in a reasonable range. This verifies the operation of mosfet driving circuit and current measurement circuit on MCU #1
• “Test I su ponte CH2”: this test causes a certain amount of current to flow in the load through the MOSFETs, reads back the current measurement and verifies the value is in a reasonable range. This verifies the operation of mosfet driving circuit and current measurement circuit on MCU #2.
• “Test protezione di corrente su CH 1”: This test causes an huge current to flow in the load for few microseconds and checks for the hardware current protection to detect it (MCU #1).
• “Test protezione di corrente su CH 2”: This test causes an huge current to flow in the load for few microseconds and checks for the hardware current protection to detect it (MCU #2).
• “fase 2 con componenti TH”: this is not really a test. It just remind the operator to perform the phase 2 test sequence once the through hole components (terminal blocks and mosfets) are assembled.

Intermidiate Manual Step

This section describes a step which should be done manually at the end of this phase. Basically this 2FOC board is actually the union of 2 single FOC boards. Therefore some small modifications should be made manually in order to correctly use the board as a single one. It should be noted that this step, as the one described at the end of phase2, can be both made when all tests have been completed, however, it is suggested to do this before mounting the heatsink and the through-hole components to make the execution easier. Thus, it is necessary to add a soldering point on the bridge that connects the 2 faults of the 2 cores, so that they can communicate and be both connected to ground even if the fault cable is connected just to one side of the board. The soldering point should be added on the bridge identified on the schematic as F3, which is shown in the image below.

Moreover, the following image of the Gerber Files shows the placement of the bridge on the TOP of the board

Phase 2

This phase should be performed with the test JIG as well, when the 2FOC board is fully assembled including terminal blocks and MOSFETs. Power can be supplied by either using the 2FOC terminal block or using the power supply of the jig and keeping the VCC and GND needles pointing on the board. Moreover, it does not make any difference to have both supply cables connected since JIG and BOARD will be at the same voltage difference. Then two external resistive loads are connected to the motor phases terminal blocks. The image below shows how the JIG and a board with THT components (in this case the GOLDENBOARD ) should be configured to run the second part of the validation procedure.

In order to perform phase 2 tests, it is required to load the “fase2.xml” configuration file in the test software. This can be easily done selecting “open” in the “file” menu. To revert back to the phase 1 test sequence the file "fase1.xml” should be loaded.

Phase 2 tests brief description
• “Preparazione scheda”: This is not really a test, but it describes all the operations required in order to prepare the DUT for testing (cables connection)
• “Test assorbimento”: The DUT current consumption is checked to detect power circuit major failures or DUT power shorts.
• “Flash Bootloader core 1”: This test re-flashes the bootloader on the first core of the 2FOC.
• “Flash Bootloader core 2”: This test re-flashes the bootloader on the second core of the 2FOC.
• “Manual reset 1”: This is just a required step to be sure to set the board in a status ready to be flashed with the test firmware
• “Flash test firmware on core 1”: This test flashes the first core of the 2FOC with the test firmware.
• “Flash test firmware on core 2”: This test flashes the second core of the 2FOC with the test firmware. All these last programming steps are done so that we are sure that the board has flashed the test firmware and thus, it is ready to proceed on the following steps as expected. This is useful if someone desires to re-run the whole tests with the GOLDENBOARD to have a ground truth on the status of the test equipment.
• “Manual reset 2”: This is just a required step to be sure to set the board in a status ready to proceed with the following tests.
• “Verifica FW collaudo canale 1”: This test verifies the presence and aliveness of (correct version of) test firmware on MCU #1
•  “Verifica versione HW canale 1”: The HW revision string reported by the MCU #1 is checked. Currently this value is hardcoded in the firmware. Hardware detection mechanisms are not implemented yet
• “Verifica revisione silicio canale 1”: The MCU #1 silicon revision is checked. Some old MCUs are not compatible with the application and they should not pass this test.
• “Verifica FW collaudo canale 2”: This test verifies the presence and aliveness of the (correct version of) test firmware on MCU #2
• “Verifica versione HW canale 2”: The HW revision string reported by the MCU #2 is checked. Currently this value is hardcoded in the firmware. Hardware detection mechanisms are not implemented yet
• “Verifica revisione silicio canale 2”: The MCU #2 silicon revision is checked. Some old MCUs are not compatible with the application and they should not pass this test.
• “Test fault a riposo su CH1”: The MCU #1 overcurrent detection circuit output is verified when the current is not flowing on the loads
• “Test lettura ADC fase 1 CH1”:  the MCU #1 current reading circuit on motor phase 1 is checked. 
• “Test lettura ADC fase 2 CH1”: the MCU #1 current reading circuit on motor phase 2 is checked. 
• “Test pull-down PWM CH1”: the pull-down resistors presence on the PWM MCU #1 output signals is checked
• “Test short ponte CH 1 fase X”: This test detects if due to some malfunction one of the two MOSFETs on the X motor phase (MCU #1) is wrongly driven “closed”.
• “Test short ponte CH 1 fase Y”: This test detects if due to some malfunction one of the two MOSFETs on the Y motor phase (MCU #1) is wrongly driven “closed”.
• “Test short ponte CH 1 fase Z”: This test detects if due to some malfunction one of the two MOSFETs on the Z motor phase (MCU #1) is wrongly driven “closed”.
• “Test I su ponte CH 1”: this test causes a certain amount of current to flow in the load through the MOSFETs, reads back the current measurement and verifies the value is in a reasonable range. This verifies the operation of mosfet driving circuit and current measurement circuit on MCU #1
• “Test fault a riposo su CH2”: The MCU #2 overcurrent detection circuit output is verified when the current is not flowing on the loads
• “Test lettura ADC fase 1 CH2”: the MCU #2 current reading circuit on motor phase 1 is checked. 
• “Test lettura ADC fase 2 CH2”: the MCU #2 current reading circuit on motor phase 2 is checked. 
•  “Test pull-down PWM CH2”: the pull-down resistors presence on the PWM MCU #2 output signals is checked
•  “Test short ponte CH 2 fase X”: This test detects if due to some malfunction one of the two MOSFETs on the X motor phase (MCU #2) is wrongly driven “closed”.
• “Test short ponte CH 2 fase Y”: This test detects if due to some malfunction one of the two MOSFETs on the Y motor phase (MCU #2) is wrongly driven “closed”.
• “Test short ponte CH 2 fase Z”: This test detects if due to some malfunction one of the two MOSFETs on the Z motor phase (MCU #2) is wrongly driven “closed”.
• “Test I su ponte CH 2”: this test causes a certain amount of current to flow in the load through the MOSFETs, reads back the current measurement and verifies the value is in a reasonable range. This verifies the operation of mosfet driving circuit and current measurement circuit on MCU #2
• “Test protezione di corrente su CH 1”: This test causes an huge current to flow in the load for few microseconds and checks for the hardware current protection to detect it (MCU #1).
• “Test protezione di corrente su CH 2”: This test causes an huge current to flow in the load for few microseconds and checks for the hardware current protection to detect it (MCU #2).
• “Update firmware repo”: This is not really a test, it updates the binaries of the bootloader and firmware using git.
• “FLASH bootloader canale 1”: This flashes the updated bootloader.
• “FLASH bootloader canale 2”: This flashes the updated bootloader.
• “FLASH firmware canale 1”: This flashes the updated firmware.
• “FLASH firmware canale 2”: This flashes the updated firmware.
• “Etichettatura”: This is not really a test, it is to remember to the operator to place the label on the DUT.

Final Manual Step

This section describes an operation that should be made manually similar to what described in Intermidiate Manual Step. In this case it is necessary to add a soldering point to the bridges identified as F1 and F2 on the schematic as shown by the image below.

In this case, the modification should be easier to make since the bridges are placed on the bottom of the board as shown below.

4 Troubleshooting

This sections describes particular problematic conditions that might happen while working on the tests and how to tackle them.

ESD-CAN drivers errors

This is a problem that might happen quite frequently depending on multiple factors such as: version of Windows OS used, type of connection used between PC and ESD CAN-USB (usb-dongle, docking station or PC USB), version of ESD-CAN used and driver installed with the test suite tool. Therefore, here is shown the specific problem that is likely to happen and 2 possible solutions that should fix it. Specifically, if at the start of the first test operation the user observes the following error:

that states that it is not possible to open the CAN interface, this is due to a connection problem of the ESD CAN-USB device. In order to solve the problem there are 2 possible ways:

  1. The first action that one can do is trying to uninstall the device from the Windows Device Manager, then disconnect and reconnect the USB cable between PC and ESD CAN-USB device. This is the fastest procedure that one can try and it solves the problem in most of the cases. The video below shows how to do that and how the error is then solved. Thus the actions to do are here described: open the Device Manager application, uninstall the usb device, disconnect the device usb cable and finally reconnect the device usb cable
  1. The other valuable option one can do is to update the device drivers from the Windows Device Manager, then disconnect and reconnect the USB cable between PC and ESD CAN-USB device. This is a slighlty more cumbersome procedure that one can try and it should solve the problem if the previous way fails. In order to provide the user with the correct drivers, those have been stored in the installation package in 2FOCTEST\drivers_can. For installing the correct driver you do not need to look for the specific one. You just need to pass to the wizard prompt in the Device Manager driver updater the whole folder and the system will autonomously install the right one. The video below shows how to do that and how the error is then solved. Thus the actions to do are here described: open the Device Manager application, select the broken device and choose Update driver option, follow the installtion steps and finally reconnect the device usb cable