foxBMS  1.1.0
The foxBMS Battery Management System API Documentation
mxm_basic_defines.h
Go to the documentation of this file.
1 /**
2  *
3  * @copyright © 2010 - 2021, Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V.
4  * All rights reserved.
5  *
6  * SPDX-License-Identifier: BSD-3-Clause
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions are met:
10  *
11  * 1. Redistributions of source code must retain the above copyright notice, this
12  * list of conditions and the following disclaimer.
13  *
14  * 2. Redistributions in binary form must reproduce the above copyright notice,
15  * this list of conditions and the following disclaimer in the documentation
16  * and/or other materials provided with the distribution.
17  *
18  * 3. Neither the name of the copyright holder nor the names of its
19  * contributors may be used to endorse or promote products derived from
20  * this software without specific prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
25  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
26  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
28  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32  *
33  * We kindly request you to use one or more of the following phrases to refer to
34  * foxBMS in your hardware, software, documentation or advertising materials:
35  *
36  * - ″This product uses parts of foxBMS®″
37  * - ″This product includes parts of foxBMS®″
38  * - ″This product is derived from foxBMS®″
39  *
40  */
41 
42 /**
43  * @file mxm_basic_defines.h
44  * @author foxBMS Team
45  * @date 2020-02-11 (date of creation)
46  * @updated 2020-06-22 (date of last update)
47  * @ingroup DRIVERS
48  * @prefix MXM
49  *
50  * @brief Basic defines for the complete Maxim driver
51  *
52  * @details def
53  *
54  */
55 
56 #ifndef FOXBMS__MXM_BASIC_DEFINES_H_
57 #define FOXBMS__MXM_BASIC_DEFINES_H_
58 
59 /*========== Includes =======================================================*/
60 #include "general.h"
61 
62 #include "battery_system_cfg.h"
63 
64 /*========== Macros and Definitions =========================================*/
65 
66 /**
67  * @brief Maximum number of modules
68  *
69  * Maximum number of modules that can be connected to one UART daisy-chain.
70  * This value is defined in the Maxim Battery Management Protocol and cannot be
71  * changed.
72  */
73 #define MXM_MAXIMUM_NR_OF_MODULES (32u)
74 
75 /**
76  * @brief Maximum number of cells per module
77  *
78  * Maximum number of cells that can be connected to one module. This value
79  * is given by the hardware and cannot be changed.
80  */
81 #define MXM_MAXIMUM_NR_OF_CELLS_PER_MODULE (14u)
82 
83 /**
84  * @brief Maximum number of AUX ports per module
85  *
86  * Maximum number of AUX ports that can be on one module. This value is given
87  * by the hardware and cannot be changed.
88  */
89 #define MXM_MAXIMUM_NR_OF_AUX_PER_MODULE (6u)
90 
91 /**
92  * @brief Type of monitoring device.
93  *
94  * This enum describes the available types of monitoring devices.
95  * These values also align with the register values on the corresponding
96  * devices and should therefore not be altered.
97  */
98 typedef enum MXM_MODEL_ID {
99  MXM_MODEL_ID_NONE = 0u, /*!< init value for registry */
100  MXM_MODEL_ID_MAX17852 = 0x852u, /*!< monitoring IC MAX17852 */
101  MXM_MODEL_ID_MAX17853 = 0x853u, /*!< monitoring IC MAX17853 */
102  MXM_MODEL_ID_MAX17854 = 0x854u, /*!< monitoring IC MAX17854 */
104 
105 /** values that the datacheck byte can assume */
106 typedef enum MXM_DC_BYTE {
107  MXM_DC_PEC_ERROR = (1u << 7u), /*!< PEC Error */
108  MXM_DC_ALRTFMEA = (1u << 6u), /*!< FMEA alert */
109  MXM_DC_ALRTSTATUS = (1u << 5u), /*!< alert from status register */
110  MXM_DC_AUXOV = (1u << 4u), /*!< OV or UT on AUX */
111  MXM_DC_AUXUV = (1u << 3u), /*!< UV or OT on AUX */
112  MXM_DC_CELLOV = (1u << 2u), /*!< OV on CELLs */
113  MXM_DC_CELLUV = (1u << 1u), /*!< UV on CELLs */
114  MXM_DC_RESERVED = 1u, /*!< reserved */
115  MXM_DC_EMPTY = 0u, /*!< empty data-check-byte */
117 
118 /** valid values for the silicon version of connected monitoring ICs */
119 typedef enum MXM_siliconVersion {
120  MXM_siliconVersion_0 = 0x0u, /*!< initialization value */
121  MXM_siliconVersion_1 = 0x1u, /*!< silicon version 1 (known from datasheet) */
122  MXM_siliconVersion_2 = 0x2u, /*!< silicon version 2 */
123  MXM_siliconVersion_3 = 0x3u, /*!< silicon version 3 */
124  MXM_siliconVersion_4 = 0x4u, /*!< silicon version 4 (located on old EV kit 2018) */
125  MXM_siliconVersion_5 = 0x5u, /*!< silicon version 5 (located on new EV kit 04.2019) */
126  MXM_siliconVersion_7 = 0x7u, /*!< silicon version 7 (located as Sample on 4-Cell-Boards) */
128 
129 /** Conversion Type */
130 typedef enum MXM_CONVERSION_TYPE {
131  MXM_CONVERSION_UNIPOLAR, /*!< unipolar measurement */
132  MXM_CONVERSION_BIPOLAR, /*!< bipolar measurement */
133  MXM_CONVERSION_BLOCK_VOLTAGE, /*!< measurement of block voltage */
135 
136 /** Type of measurement */
137 typedef enum MXM_MEASURE_TYPE {
138  MXM_MEASURE_CELL_VOLTAGE, /*!< cell voltage measurement */
139  MXM_MEASURE_TEMP, /*!< temperature measurement */
140  MXM_MEASURE_BLOCK_VOLTAGE, /*!< block voltage measurement */
142 
143 /**
144  * struct that summarizes all types of measurement values of the monitoring IC
145  */
146 typedef struct MXM_DATA_STORAGE {
147  /** array of all cell voltages measured by the driver */
149  /** array of all voltages measured by the driver on the AUX inputs */
151  /** array of all measured block voltages */
154 
155 /*========== Extern Constant and Variable Declarations ======================*/
156 
157 /*========== Extern Function Prototypes =====================================*/
158 
159 /*========== Externalized Static Functions Prototypes (Unit Test) ===========*/
160 
161 #endif /* FOXBMS__MXM_BASIC_DEFINES_H_ */
Configuration of the battery system (e.g., number of battery modules, battery cells,...
General macros and definitions for the whole platform.
#define MXM_MAXIMUM_NR_OF_CELLS_PER_MODULE
Maximum number of cells per module.
enum MXM_MODEL_ID MXM_MODEL_ID_e
Type of monitoring device.
#define MXM_MAXIMUM_NR_OF_AUX_PER_MODULE
Maximum number of AUX ports per module.
MXM_siliconVersion
@ MXM_siliconVersion_2
@ MXM_siliconVersion_0
@ MXM_siliconVersion_1
@ MXM_siliconVersion_7
@ MXM_siliconVersion_3
@ MXM_siliconVersion_5
@ MXM_siliconVersion_4
enum MXM_siliconVersion MXM_siliconVersion_e
MXM_CONVERSION_TYPE
@ MXM_CONVERSION_BIPOLAR
@ MXM_CONVERSION_UNIPOLAR
@ MXM_CONVERSION_BLOCK_VOLTAGE
enum MXM_DC_BYTE MXM_DC_BYTE_e
struct MXM_DATA_STORAGE MXM_DATA_STORAGE_s
enum MXM_MEASURE_TYPE MXM_MEASURE_TYPE_e
enum MXM_CONVERSION_TYPE MXM_CONVERSION_TYPE_e
MXM_DC_BYTE
@ MXM_DC_ALRTSTATUS
@ MXM_DC_RESERVED
@ MXM_DC_EMPTY
@ MXM_DC_AUXOV
@ MXM_DC_ALRTFMEA
@ MXM_DC_CELLUV
@ MXM_DC_AUXUV
@ MXM_DC_CELLOV
@ MXM_DC_PEC_ERROR
MXM_MODEL_ID
Type of monitoring device.
@ MXM_MODEL_ID_MAX17853
@ MXM_MODEL_ID_MAX17852
@ MXM_MODEL_ID_MAX17854
@ MXM_MODEL_ID_NONE
#define MXM_MAXIMUM_NR_OF_MODULES
Maximum number of modules.
MXM_MEASURE_TYPE
@ MXM_MEASURE_CELL_VOLTAGE
@ MXM_MEASURE_BLOCK_VOLTAGE
@ MXM_MEASURE_TEMP
uint16_t blockVoltages[MXM_MAXIMUM_NR_OF_MODULES]
uint16_t cellVoltages_mV[MXM_MAXIMUM_NR_OF_MODULES *MXM_MAXIMUM_NR_OF_CELLS_PER_MODULE]
uint16_t auxVoltages_mV[MXM_MAXIMUM_NR_OF_MODULES *MXM_MAXIMUM_NR_OF_AUX_PER_MODULE]