Software

To understand and work with the provided BMS master software it is necessary to have a general knowledge about STM32 microcontroller software and the BMS master hardware.

Therefore, read the capter Battery Management System - Master (BMS-Master) at first and have a look at the following chapter General knowledge - STM32.

General knowledge - STM32

Since there are already different documentations and youtube videos for the STM32 development available, here are only some hints which documentation could be helpful.

  • Getting started with STM32: STM32 step by step

    Hint

    The understanding of step 1 and step 2 are neccessary for the Battery Management software!

Battery Management System - Master

In general the Battery Managment System Master is responsible for monitoring and controling the battery system depending on different input signals. The software itself is running on a STM32-F407 microcontroller by using the peripherie of the microcontroller (SPI, CAN, GPIO, JTAG).

The following peripherie of the microcontroller is used: (For detailed information regarding the hardware see chapter Battery Management System - Master (BMS-Master).)

Communication interfaces (isoSPI and CAN):

  • BMS master to BMS slave via isoSPI (to read out the single cell voltages and temperatures)

  • BMS master to VCU via CAN

Components/ Values which are control by the BMS master via GPIO output:

  • BMS error

  • Negative AIR

  • Positive AIR

  • Precharge Relay/ AIR

Values which are evaluated by the BMS master via a GPIO input:

  • Shutdown cirucit (SC)

  • Auxilary contact of the negative AIR

  • Auxilary contact of the positive AIR

  • Auxilary contact of the precharge relay/ AIR

  • BMS latched signal

  • IMD latched signal

  • TSAL green

  • HVIL red

  • Activate Tractive System (button)

  • Reset IMD error (button)

  • Reset BMS error (button)

Design Software Architecture

The BMS master software is split in two parts.

  1. The generated STM32 part from the CubeMX project, which should only be adapted by using CubeMX or adapations only made in the specific regions in the generated C code.

    The generated STM32 part is documented in the STM32 F407 documentation.

    Further information are not provided in this documentation.

  2. The specific part for the battery managment, which can be adapted to the needs of your battery system.

In the UML diagram, the specific software files, which can be adapted is shown with .c and .h files. The files, which are marked in red in the UML diagram, must be manually adapted by the user depending on the system.

Hint

If the battery is completely constructed regarding this documentation the preconfigured default files and values can be used. No manual adaption is necessary!

File include structure

The following files must manually be adapted regarding the specific use case if something is changed in the battery concept:

  • general_cfg.h

    Configure the general parameter which are used for the software as preprocessor switches.

    Hint

    Becareful with configuration. Take care of the hints provided in the comments above.

  • app_bms_cfg.h

    Configure manually the cell parameters voltage and temperature for used cell.

  • can_if_cfg_isascale.h

    Configure manually the CAN IDs for the isascale. The following table shows the default CAN IDs which are used for default.

  • can_if_cfg.h

    Configure the CAN IDs for the cell voltages, cell temperatures and general values. The following tables show the default CAN IDs which are used for default.

  • ltc6811_if_cfg.h: ToDo

    Configure the parameter depending on the used BMS slave hardware and the used temperature sensor.

CAN messages

For the communication between the BMS master and the VCU (vehicle control unit) CAN messages are used.

The following tables give an overview over the preconfigured CAN messages in the can_if_cfg.h.

Overview of the CAN message IDs

CAN ID

CAN messages content

type

0x200

Average values, Sum of Voltage

Transmit

0x201

Min, Max value of Voltage

Transmit

0x202

Min, Max value of Temperature

Transmit

0x203

Error States

Transmit

0x521

Isascale: I

Receive

0x522

Isascale: U1

Receive

0x523

Isascale: U2

Receive

0x524

Isascale: U3

Receive

0x600

All Cell Voltages (multiplexed)

Transmit

0x601

All Cell Temperatures (multiplexed)

Transmit

Structure of CAN message 0x200

Position (Byte)

Content

0

Average voltage value calculated over all cells (high byte)

1

Average voltage value calculated over all cells (low byte)

2

Average temperature value calculated over all cells (high byte)

3

Average temperature value calculated over all cells (low byte)

4

Sum of all cells (high byte)

5

Sum of all cells (low byte)

Structure of CAN message 0x201

Position (Byte)

Content

0

ID of the cell with the minimum voltage

1

Value of the cell with the minimum voltage (high byte)

2

Value of the cell with the minimum voltage (low byte)

3

ID of the cell with the maximum voltage

4

Value of the cell with the maximum voltage (high byte)

5

Value of the cell with the maximum voltage (low byte)

Structure of CAN message 0x202

Position (Byte)

Content

0

ID of the cell with the minimum temperature

1

Value of the cell with the minimum temperature (high byte)

2

Value of the cell with the minimum temperature (low byte)

3

ID of the cell with the maximum temperature

4

Value of the cell with the maximum temperature (high byte)

5

Value of the cell with the maximum temperature (low byte)

Structure of CAN message 0x203

Position (Byte)

Position (Bit)

Content

Description

0

0

State of IMD reset button

0: Released 1: Pressed

0

1

State of BMS reset button

0: Released 1: Pressed

0

2

State of TS button

0: Released 1: Pressed

1

0

Error state: Undervoltage

0: No error 1: Error

1

1

Error state: Overvoltage

0: No error 1: Error

1

2

Error state: Undertemperature

0: No error 1: Error

1

3

Error state: Overtemperature

0: No error 1: Error

1

4

Error state: Overcurrent discharge

0: No error 1: Error

1

4

Error state: Overcurrent charge

0: No error 1: Error

And the specific CAN messages for the isascale configured in the file can_if_cfg_isascale.h.

Structure of CAN message 0x521

Position (Byte)

Content

2

Current value (Byte 1)

3

Current value (Byte 2)

4

Current value (Byte 3)

5

Current value (Byte 4)

Structure of CAN message 0x522

Position (Byte)

Content

2

U1 value (Byte 1)

3

U1 value (Byte 2)

4

U1 value (Byte 3)

5

U1 value (Byte 4)

Structure of CAN message 0x523

Position (Byte)

Content

2

U2 value (Byte 1)

3

U2 value (Byte 2)

4

U2 value (Byte 3)

5

U2 value (Byte 4)

Structure of CAN message 0x524

Position (Byte)

Content

2

U3 value (Byte 1)

3

U3 value (Byte 2)

4

U3 value (Byte 3)

5

U3 value (Byte 4)

How to connect, flash and debug

Possible commissioning preprocessor

Monitoring Software

Still under construction….

Link to the git repository: Monitoring Software