4. Eclipse Workspace Setup and Flashing¶
In this section, it is shown how to set up an Eclipse workspace to work with the foxBMS sources. Within the workspace, it is possible to flash the compiled sources on the foxBMS Master Unit.
4.1. Setting an Eclipse Workspace¶
Warning
Every part of this setup instruction must be read carefully and it must be followed step by step, including details. If this is not the case, the Eclipse Workspace will not work.
Warning
Only foxconda3
(see Installing foxconda3) is supported.
The support for older versions of foxconda
has been dropped.
In the following, it is described which requirements have to be fulfilled and what steps have to be made to setup an Eclipse workspace for working with the foxBMS sources.
Note
The following setup instructions use two variables which have to be adapted to the user’s settings. The example below shows how to adapt these two variables.
Variable 1: Path to the project directory
- The project directory is
foxbms
. The path to the project is thereforepath\to\foxbms
(e.g.,C:\Users\username\Documents\foxbms
,C:\projects\foxbms
, etc.). This means, during this setup procedure where ever the variablepath\to\foxbms
occurs it needs to be replaced with actual project directory on the machine (e.g.,C:\Users\username\Documents\foxbms
orC:\projects\foxbms
, etc.). - The path to the project directory must not contain spaces.
- The project directory is
Variable 2: Path to
foxconda3
installation- The preferred installation path of
foxconda3
isC:\foxconda3
. This path will be used during the setup. If this is changed, it is up to the reader to change it at time to the appropriate path. It is strongly recommended to install foxconda toC:\foxconda3
. - If
foxconda3
is installed intoC:\foxconda3
some steps of these instructions can be skipped. These steps are indicated.
- The preferred installation path of
4.1.1. Requirements¶
The following requirements have to be fulfilled to be able to set up an Eclipse Workspace for working with the foxBMS sources.
foxconda3
is installed.foxBMS source files are downloaded to
path\to\foxbms
. Getting the source files is described in section “Building the foxBMS Software and Documentation”.Eclipse CDT , in version Oxygen.1.Release (4.7.1a). Eclipse CDT Oxygen.1.Release (4.7.1a) can be downloaded form eclipse.org. After downloading the
.zip file
and extracting it,eclipse.exe
must be started to launchEclipse CDT
.The following plugins must be installed into
Eclipse CDT
.PyDev
(PyDev project website) is mandatory, whileLiClipseText
(LiClipseText project website) is optional. However it is recommended to install both plugins. The plugins can be installed from theEclipse Marketplace
.Fig. 4.1
Eclipse Marketplace
Installing
PyDev
Fig. 4.2
PyDev
Eclipse plugin- Click
to install the plugin.
- Click
Installing
LiClipseText
Fig. 4.3
LiClipseText
Eclipse plugin- Click
to install the plugin.
- Click
4.1.2. How to Setup the Eclipse Workspace¶
The setup process is divided into following parts:
The order of these steps must not be changed.
4.1.2.1. Creating the Workspace¶
The Eclipse Workspace will be called .ws
.
Start
Eclipse
and clickFile
->Switch Workspace
->other
and configurepath\to\foxbms\.ws
as workspace, see Fig. 4.4.Click
The foxBMS Eclipse Workspace is now successfully created.
4.1.2.2. Configuring Default Encoding and Newline Delimiter¶
Open
Window
->Preferences
->General
->Workspace
Set
Text file encoding
toOther: UTF-8
andNew text file line delimiter
and selectOther: Windows
Fig. 4.5 Setting the default file encoding and the line delimiter
Click
4.1.2.3. Configuring the Python Interpreter¶
Open
Window
->Preferences
->PyDev
->Interpreters
->Python Interpreter
.Fig. 4.6 Selecting the python interpreter
Click
. In the window
Select Interpreter
usefoxconda3
for theInterpreter Name
C:\foxconda3\python.exe
forInterpreter Executable
.
Click
In menu
Selection needed
do not change anything and clickClick
foxconda3
is now successfully selected as Python interpreter.
4.1.2.4. Importing the Project¶
Import the project via
File
->Import
Fig. 4.10 Select
Import
Click
General
->Existing Projects into Workspace
.Fig. 4.11 Select projects import by
Existing Projects into Workspace
Click
Chose
Select archive file:
and usepath\to\foxbms\tools\eclipse\foxbms-eclipse-project.zip
This will list the foxBMS projects.Fig. 4.12 Select all projects to be imported
Note
Always import all projects that appear, as the number of projects might increase with future updates and this help might not be up-to-date.
Click
to complete the project import process.
The foxBMS projects are now successfully imported.
4.1.2.5. Configuring the Project PATHs¶
Note
If foxconda3
was installed in the default installation path
(C:\foxconda3
), this section can be skipped.
For this setup: Change the path C:\foxconda3
to the path
where foxconda3
was installed to.
Select the
Primary
project and click right and selectProperties
.Fig. 4.13 Eclipse project properties
Goto
C/C++ Build
->Environment
. Select[All configurations]
Fig. 4.14
C/C++ Build
project propertiesClick
and
use
FOXCONDA3
forName
use
C:\foxconda3;
C:\foxconda3\bin;
C:\foxconda3\Scripts;
C:\foxconda3\Library\bin;
C:\foxconda3\Lib;
forValue
.Warning
- The
Value
property must not include spaces. - Do not add a backslash (
\
) at the end of the paths. - These paths need to be in a single line.
- The
Check
Add to all configurations
Click
Click
and
- Use
PATH
forName
- Leave
Value
empty - Click
- Use
Select the
PATH
entry and click- Delete all entries in
Value
- Add
${FOXCONDA3};
toValue
- Click
- Delete all entries in
The result should look like this:
Fig. 4.15
Environment
settings for the project.Repeat these steps for the following projects:
documentation
foxbms
secondary
The foxBMS projects now include the correct environment settings.
4.1.2.6. Configuring the Project Includes¶
Note
If foxconda3
was installed in the default installation path
(C:\foxconda3
), this section can be skipped.
For this setup: Change the path C:\foxconda3
to the path
where foxconda3
was installed to.
Select the
primary
project and click right. GotoC/C++ General
->Paths and Symbols
and switch to TabIncludes
.Click
for
Assembly
,GNU C
andGNU C++
and configure the following two paths asIncludes
C:\foxconda3\Library\arm-none-eabi\include
C:\foxconda3\Library\lib\gcc\arm-none-eabi\4.9.3\include
Fig. 4.16 Adding the gcc-includes to a project
- Click
Repeat this procedure for the
secondary
project.Restart Eclipse
The foxBMS projects are now successfully configured.
4.1.2.7. Testing the Project Setup¶
foxbms
projectSelect the
foxbms
project and clickbutton and select
1 configure
. The project is now configured and all options (building documentation and binaries) can now be used.'configure' finished successfully (0.450s)
Select the
foxbms
project and clickbutton and select
2 help
. The project help for building is printed.
documentation
projectSelect the
documentation
project and click on the dropdown menu of thebutton and select
1 sphinx
to build the general foxBMS documentation.'sphinx' finished successfully (0.105s)
The
Documentation
project is now successfully tested.
primary
projectSelect the
primary
project and click on the dropdown menu of thebutton and select
1 build_primary
to build the foxBMS binaries of the primary mcu.The binary generation was successful, if the Eclipse console puts the following line at the bottom:
'build_primary' finished successfully (1.340s)
Select the
primary
project and click on the dropdown menu of thebutton and select
2 doxygen_primary
to build the foxBMS embedded documentation of the primary mcu.The primary mcu dopxygen documentation generation was successful, if the Eclipse console puts the following line at the bottom:
'doxygen_primary' finished successfully (46.906s)
Select the
primary
project, right click the project and selectClean Project
The cleaning of the primary mcu binaries and doxygen documentation was successful, if the Eclipse console puts the following line at the bottom:
'clean_primary' finished successfully (1.065s)
The
primary
project is now successfully tested.
secondary
project- Select the
secondary
project and repeat all steps of theprimary
project. - The
secondary
project is now successfully tested.
- Select the
The foxBMS Eclipse Workspace is now successfully tested.
Warning
To test flashing in the next step, binaries of the primary and secondary mcu need to be build again.
4.1.3. Optional Settings¶
When working with the build scripts (wscript
) it is more convenient to have
python syntax highlighting. The following has to be configured to achieve it:
Click
Window
->Preferences
Select
General
->Editors
->File Associations
At the entry
File types
clickFig. 4.17
File Associations
settingsDefine the file type
wscript
and clickFig. 4.18
File type definition
Select the
Python Editor
as and clickEditor Selection
setting
Finish the configuration by clicking
Fig. 4.20 Final file association setting for
wscript
4.2. Flashing foxBMS¶
This section describes how to supply the foxBMS Master Unit in order to flash both MCU0 and MCU1 with the firmware produced by compiling the C-code source files.
This section shows how to connect the different parts of the foxBMS platform.
4.2.1. Convention for Connector Numbering¶
Fig. 4.21 presents the convention for the connector numbering. It is used throughout the documentation.

Fig. 4.21 Supply connector pin out, receptable - rear view, header - front view (image source: MOLEX)
There are two types of connectors:
- Header
- Receptable, plugged into the header
The numbering shown on the left in
fig. 4.21 is always valid when viewing in
the direction indicated by the arrow with the indication viewing direction
.
This must be taken into account when crimping the receptables.
4.2.2. Hardware Setup of foxBMS Master Unit and foxBMS Slave Units¶
The foxBMS system can be mounted in a metal housing, as shown in fig. 4.22.
Connectors are available, shown in Fig. 4.23, which presents all the connectors of the foxBMS Master Unit.
For this section on flashing, only the connector Supply
is needed.
4.2.3. Supply of the foxBMS Master Unit¶
The first step is to supply the foxBMS Master Unit, which works with supply voltages
between 12V and 24V DC. To supply the foxBMS Master Unit, a connector must be prepared
for the Supply
connector as shown in
table 4.1, which describes the different
pins used.
Pin | Signal | Input/Output | Description |
---|---|---|---|
1 | SUPPLY_EXT_2 | Input | 12 - 24V |
2 | SUPPLY_EXT_2 | Input | 12 - 24V |
3 | GND_EXT_2 | Input | GND |
4 | SUPPLY_EXT_0 | Input | 12 - 24V |
5 | GND_EXT_0 | Input | GND |
6 | GND_EXT_2 | Input | GND |
The supply is separated as follows:
- The microcontrollers and the isolation devices are supplied through the pins
SUPPLY_EXT_0
andGND_EXT_0
- The contactors and the interlock are supplied through the pins
SUPPLY_EXT_2
andGND_EXT_2
To power up the foxBMS Master Unit, plug in the supply connector and apply a voltage
between 12V and 24V. SUPPLY_EXT_0
/ GND_EXT_0
and SUPPLY_EXT_2
/
GND_EXT_2
may be connected to the same source for this initial test. At
this point, the foxBMS Master Unit should draw approximately 150mA at 12V or 110mA at
24V.
4.2.4. Primary and Secondary MCU¶
The BMS-Master Board has two MCUs: primary (MCU0) and secondary (MCU1). The MCU1 is present to ensure redundant safety especially when used in research and development prototyping.
First, the primary MCU will be flashed.
In order to program the primary MCU, the mini USB jack indicated as
Prim. USB
in fig. 4.23 must be used
to connect the foxBMS Master Unit to a PC. The foxBMS Master Unit can be connected to a PC
immediately. When connecting foxBMS Master Unit for the first time, the required drivers
will install automatically.
Note
Before the connection is made between the foxBMS Master Unit and the computer for the first time, the computer must be connected to the internet, because the operating system might look for drivers on the internet. It this fails, administrator rights are needed to install the driver.
In case of problems by the installation of the drivers, administrator rights might be needed. Once the hardware is supplied with the appropriate voltage, the foxBMS binaries can be flashed.
The same procedure must be made for secondary: the mini USB jack indicated as
Sec. USB
in fig. 4.23 must be used
to connect the foxBMS Master Unit to a PC. As for the primary MCU, the PC must be
connected to the internet before the connection is made with the foxBMS Master Unit for
the first time.
4.2.5. Flashing the Compiled Sources for the Primary MCU¶
In the chapter Building the foxBMS Software and Documentation, the foxBMS sources have been compiled and the generated binary is ready to be flashed. The MCU0 will be flashed first.
These binaries are needed:
- a binary file with the header
- a binary file with the main code
Unless the build process has been altered or different binaries should be flashed, there is no need to change the default file locations. For this guide, the default file locations are used.
The device must be connected to the computer with the USB cable. The MCU0
USB-connector must be used. The primary
project must be select. Clicking on
the dropdown menu of the button and selecting
3 flash_primary
allows flashing the foxBMS binaries of the primary mcu.
Note
Make sure that CAN0 connector is either disconnected or that there is no
traffic on CAN0 bus while flashing primary
MCU. If this is not the
case, the internal bootloader of the controller will select a wrong boot
source and the flashing fails.
The connection state can also be checked by watching the LEDs on the foxBMS Master Unit hardware: for a running board, the green power LED is on, and the two indicator LEDs (green and red) are blinking alternately. If the device is connected and being flashed, the power-on LED is on but the two indicator LEDs are off.
The LEDs for the MCU0 must be used. In the Cabling foxBMS, it is explained how to find the MCU0 indicator LEDs.
When the flashing is complete, the flashing windows disappears and the indicator LEDs start to blink again.
Under Windows 7 (64 bit), it can happen that the COMPORT number is increased by
Windows, leading to problems during flashing. This can be reset in registry, by
setting ComDB
to zero in the entry
HKEY_LOCAL_MACHINE::SYSTEM::CURRENT_CONTROL_SET::CONTROL::COM NAME ARBITER
.
This way, all COM ports used are reset.
4.2.6. Flashing the Compiled Sources for the Secondary MCU¶
The same procedure as explained above must be followed for the MCU1. The
difference is that the MCU1 USB-connector must be used. The secondary
project must be selected before clicking on the dropdown menu of the
button.
3 flash_secondary
must then be selected to flash the
foxBMS binaries of the secondary mcu.
With the supplied code, the MCU1 checks the temperatures and voltages. If one or more of the values are outside the limits, the MCU1 opens the interlock line (thus opening the contactors). The interlock line remains open until the MCU1 is reset.
Note
Setting the limits is safety relevant and must be done with care.
Note
Working without configuring the right battery cell voltage limits is dangerous and should never be done when real batteries are connected, since they may burn and explode when overcharged or shorted.
The next step shown in Cabling foxBMS is to connect a foxBMS Slave Unit to perform voltage and temperature measurement.
4.2.7. Debugging the Primary and Secondary MCU¶
The following two debuggers can be used for debugging and have been tested with foxBMS:
- Segger J-Link Plus, with the 19-Pin Cortex-M adapter (needed to connect to foxBMS)
- Lauterbach µTrace Debugger for Cortex-M