EPuck2 Testing the EPuck2 - EPFL-MICRO-315/TPs-Wiki GitHub Wiki

⚠ wiki page used in TP Intro

Introduction

This section explains how to test your robot and the work environment. This is covered in the following way:

  1. Test Environment
  2. Demo program with ST Library
  3. Demo program with e-puck2_main-processor Library communicating with EPuckMonitor application on the computer
  4. DFU programming of F407

Test Environment

Use the test environment in order to test your robot and the Library properly without being dependent or impacted by your code. The reference softwares and the tasks to perform these tests are in the Lib folder.

  • run VSCode_EPuck2 application

  • open the folder Lib located in EPuck2_Workplace

    👉 Reminder: The Library folder MUST be named Lib

At that point, you should make sure that the serial port for debugging is correctly set in the .vscode/settings.json. Follow the instructions of the page Identify the ports.

Demo program 1

This program allows to test the ST libary.

  • Open the Lib folder with EPuck2 VSCode;

  • In the Project ST tab of task runner, run the task Make;

  • Go in the Run and Debug tab;

  • Select BMP ST launch to main in the launch configuration choice box;

  • Launch the selected configuration by pressing Start Debugging (the green ▷) OR press F5;

  • Run the program by pressing Continue (the blue |▶) OR press F5;

  • 4 Red LEDs on the EPuck2 robot should now be blinking.

Demo program 2

This program allows to test the e-puck2_main-processor library.

  • Open the Lib folder with EPuck2 VSCode;

  • In the Project e-puck2_main-processor tab of task runner, run the task Make;

  • Go in the Run and Debug tab;

  • Select but not run now BMP e-puck2_main-processor launch to main in the launch configuration choice box;

  • Make sure the EPuck's selector is on position 8 before running the program;

  • Launch the selected configuration by pressing Start Debugging (the green ▷) OR press F5;

  • Run the program by pressing Continue (the blue |▶) OR press F5;

  • Go back to Explorer tab and run the task Run EPuckMonitor from the group User;

  • Connect to the right COM port corresponding to STM32F407

  • Now you are ready to test all the hardware features of your EPuck2 robot and the e-puck2_main-processor library too.

DFU programming of F407

The STM32F407 microcontroller (later called F407) can be programmed through the programmer as is done in the 2 previous demonstrations; this is normally also the case during all TPs.

However, there are situations where this is not possible and the only alternative is to go through what is called DFU mode or Device Firmware Upgrade (consult Wikipedia).

This can sometimes happen when the last programmed code is running hazy and the programmer can no longer properly control the F407. In this case the following message is displayed in the DEBUG CONSOLE output:

and there is an error dialog Failed to launchGDB: Attaching to Remote target failed.

If this problem persists after having:

  • disconnected robot USB cable
  • turns off the robot
  • reconnected the USB
  • retry to program

then you must:

1) Boot in DFU mode

  • robot USB connected with the computer

  • turn off the robot

  • hold down the F407 Bootloader button

  • turn on the robot

  • you can now release the F407 Bootloader button

  • check that there is well a new device named STM32 Bootloader

[!WARNING]

ONLY for Windows

You can see whether or not a driver is installed for the STM32 BOOTLOADER by opening the device manager and searching for STM32 BOOTLOADER

⚠ The epuck2 must be connected and booted in DFU mode to be able to check that.

If there is a yellow warning you have to:

  • go to your InstallPath/EPuck2_Utils/Utils
  • run zadig-2.3.exe
  • check that STM32 BOOTLOADER is selected
  • select libusbK (....)
  • click on Install Driver

2) Program by DFU

  • run the user task DFU EPuck-2-Main_Processor

  • verify that the firmware has been successfully downloaded

  • power off the robot in order to go out the DFU mode

Now you will be able to reprogram your robot and continue to work.