foxBMS-UnitTests  1.0.0
The foxBMS Unit Tests API Documentation
mxm_1785x_tools.h
Go to the documentation of this file.
1 /**
2  *
3  * @copyright © 2010 - 2021, Fraunhofer-Gesellschaft zur Foerderung der
4  * angewandten Forschung e.V. All rights reserved.
5  *
6  * BSD 3-Clause License
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions are met:
9  * 1. Redistributions of source code must retain the above copyright notice,
10  * this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  * notice, this list of conditions and the following disclaimer in the
13  * documentation and/or other materials provided with the distribution.
14  * 3. Neither the name of the copyright holder nor the names of its
15  * contributors may be used to endorse or promote products derived from
16  * this software without specific prior written permission.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
22  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28  * POSSIBILITY OF SUCH DAMAGE.
29  *
30  * We kindly request you to use one or more of the following phrases to refer
31  * to foxBMS in your hardware, software, documentation or advertising
32  * materials:
33  *
34  * ″This product uses parts of foxBMS®″
35  *
36  * ″This product includes parts of foxBMS®″
37  *
38  * ″This product is derived from foxBMS®″
39  *
40  */
41 
42 /**
43  * @file mxm_1785x_tools.h
44  * @author foxBMS Team
45  * @date 2020-07-15 (date of creation)
46  * @updated 2020-09-10 (date of last update)
47  * @ingroup DRIVERS
48  * @prefix MXM
49  *
50  * @brief This is a collection of helper functions for the MAX1785x ICs
51  *
52  * @details This collection of helper functions for the MAX1785x ICs helps to
53  * calculate the lsb and msb for register values and similar tasks.
54  *
55  */
56 
57 #ifndef FOXBMS__MXM_1785X_TOOLS_H_
58 #define FOXBMS__MXM_1785X_TOOLS_H_
59 
60 /*========== Includes =======================================================*/
61 #include "mxm_cfg.h"
62 
63 #include "mxm_basic_defines.h"
64 #include "mxm_battery_management.h"
65 #include "mxm_register_map.h"
66 
67 /*========== Macros and Definitions =========================================*/
68 /**
69  * @brief States of the global Maxim state-machine
70  *
71  * State transitions are currently autonomous and will have to be integrated into
72  * the Battery System state-machine.
73  */
75  MXM_STATEMACHINE_STATES_UNINITIALIZED, /*!< uninitialized state */
76  MXM_STATEMACHINE_STATES_SELFCHECK_PRE_INIT, /*!< self-check that has to be executed before initialization */
77  MXM_STATEMACHINE_STATES_INIT, /*!< initialization sequence */
78  MXM_STATEMACHINE_STATES_SELFCHECK_POST_INIT, /*!< self-check that has to be executed after initialization */
79  MXM_STATEMACHINE_STATES_IDLE, /*!< idle state, the driver waits for operation here */
80  MXM_STATEMACHINE_STATES_OPERATION, /*!< operating state, the measurement cycle is executed here */
81  MXM_STATEMACHINE_STATES_MAXSTATE, /*!< highest state */
83 
84 /** states of the #MXM_StateMachineOperation() statemachine */
140 
141 /** intermediate state-definition for #MXM_MonGetVoltages() */
142 typedef enum MXM_MONITORING_STATE {
143  MXM_MONITORING_STATE_PENDING, /*!< state completion is pending */
144  MXM_MONITORING_STATE_PASS, /*!< state passed successfully */
145  MXM_MONITORING_STATE_FAIL, /*!< unrecoverable failure that has to be handled by e.g., reset (function has already tried recovery) */
147 
148 /**
149  * struct describing the different return values of selfchecks that the driver can execute
150  */
151 typedef struct MXM_SELFCHECK {
152  STD_RETURN_TYPE_e crc; /*!< CRC self-check; stores the return value of #MXM_CRC8SelfTest(). */
153  STD_RETURN_TYPE_e conv; /*!< Conversion self-check; stores the return value of #MXM_ConvertTest(). */
154  STD_RETURN_TYPE_e firstSetBit; /*!< First Set Bit self-check; stores the return value of #MXM_FirstSetBitTest(). */
156  extractValueFromRegister; /*!< Extract value from Register self-check; stores the return value of #MXM_ExtractValueFromRegisterTest(). */
158  parseVoltageReadall; /*!< Voltage parsing of READALL; stores the return value of #MXM_ParseVoltageReadallTest(). */
160  addressSpaceChecker; /*!< Address space checker; stores the return value of #MXM_5XUserAccessibleAddressSpaceCheckerSelfCheck(). */
162  fmeaStatusASCI; /*!< MAX17841B FMEA register; stores the value of the FMEA check conducted in the state #MXM_STATEMACH_41B_CHECK_FMEA. */
164 
165 /* TODO implement filling of values */
166 /* TODO read and verify OTP register */
167 
168 /** struct describing an entry into the monitoring registry */
169 typedef struct MXM_REGISTRY_ENTRY {
170  bool connected; /*!< state variable, indicates whether monitoring IC is connected */
171  uint8_t deviceAddress; /*!< address that has been assigned during enumeration */
172  MXM_MODEL_ID_e model; /*!< model (e.g. 17853) */
173  MXM_siliconVersion_e siliconVersion; /*!< silicon version of chip */
174  uint32_t deviceID; /*!< 24-bit unique device ID */
176 
177 /**
178  * @brief Length of RX buffer
179  * @details This define describes the length of the array
180  * #MXM_MONITORING_INSTANCE_s::rxBuffer. It is large enough to fit the largest
181  * message that can be written into a single buffer which consists of
182  * 6 command bytes and #MXM_MAXIMUM_NR_OF_MODULES times 2 receive
183  * bytes for the maximum number of connected monitoring ICs.
184  */
185 #define MXM_RX_BUFFER_LENGTH 100
186 
187 /** Status of the Maxim-main-state-machine. */
188 typedef struct MXM_MONITORING_INSTANCE {
189  MXM_STATEMACHINE_STATES_e state; /*!< state of the maxim state-machine */
190  MXM_STATEMACHINE_OPERATION_STATES_e operationSubstate; /*!< substate during operation of monitoring */
191  bool allowStartup; /*!< indicates whether start of state-machine has been requested */
192  bool operationRequested; /*!< indicates whether the measurement cycle should run */
193  bool firstMeasurementDone; /*!< this bit is set after the first measurement cycle */
194  bool stopRequested; /*!< indicates that no new measurement cycles should be run */
195  bool openwireRequested; /*!< indicates that an openwire-check has been requested */
197  /*!< whether undervoltage alert has occurred */ /* TODO remove? replaced by DC? */
198  MXM_DC_BYTE_e dcByte; /*!< content of the data-check-byte */
199  uint8_t mxmVoltageCellCounter; /*!< counter for getting all cellvoltages */
200  uint8_t highest5xDevice; /*!< address of highest monitoring device of the 5x family */
201  MXM_5X_STATE_REQUEST_STATUS_e requestStatus5x; /*!< status of request to 5x */
202  MXM_5X_COMMAND_PAYLOAD_s batteryCmdBuffer; /*!< buffer for Battery Management Commands */
203  STD_RETURN_TYPE_e resultSelfCheck; /*!< Status of driver-wide self-check */
204  MXM_SELFCHECK_s selfCheck; /*!< stores self check return values */
205  MXM_41B_INSTANCE_s *pInstance41B; /*!< instance-pointer of the 41b-state-machine */
206  MXM_5X_INSTANCE_s *pInstance5X; /*!< instance-pointer of the 5x-state-machine */
207  /**
208  * @brief Local storage for cell-voltages
209  *
210  * This local variable stores the measured cell- and AUX-voltages. Independent
211  * of the actual configuration, it stores the measurement values always at the
212  * same place and never changes in size.
213  * As an example the voltage of cell 5 (cells are numbered from 1 to 14)
214  * in module 0 (modules are numbered from 0 to 31) will be in entry 4.
215  * The voltage of cell 14 of module 1 will be in entry 27. This is independent
216  * of the size of the setup which is defined in the defines
217  * #BS_NR_OF_CELLS_PER_MODULE and #BS_NR_OF_MODULES.
218  * Therefore, the size of the arrays inside this struct is defined as
219  * #MXM_MAXIMUM_NR_OF_MODULES times #MXM_MAXIMUM_NR_OF_CELLS_PER_MODULE.
220  */
222  MXM_REGISTRY_ENTRY_s registry[MXM_MAXIMUM_NR_OF_MODULES]; /*!< registry for connected monitoring ICs */
223  uint8_t rxBuffer[MXM_RX_BUFFER_LENGTH]; /*!< buffer that stores the incoming data from the lower state-machines.
224  It contains the command sequence as it is received on the ASCI together with the Battery Management Protocol command. */
226 
227 /*========== Extern Constant and Variable Declarations ======================*/
228 
229 /*========== Extern Function Prototypes =====================================*/
230 /**
231  * @brief Convert a measurement value to a voltage value.
232  * @details This function converts measurement values from the monitoring
233  * IC into a voltage value. It assumes that measurement values are
234  * spread over the LSB and MSB according to the datasheet. This
235  * means that the two lowest bits are 0 and the 14-bit measurement
236  * is spread over the 14 highest bits.
237  *
238  * The conversion type describes the kind of measurement that has
239  * been executed.
240  * @param[in] lsb LSB of the value
241  * @param[in] msb MSB of the value
242  * @param[out] pTarget pointer in which the converted value
243  * shall be written
244  * @param[in] convType type of conversion (bipolar or unipolar)
245  * @param[in] fullScaleReference_mV reference voltage of full scale
246  * (for voltage measurements 5000)
247  */
248 extern void MXM_Convert(
249  uint8_t lsb,
250  uint8_t msb,
251  uint16_t *pTarget,
252  MXM_CONVERSION_TYPE_e convType,
253  uint32_t fullScaleReference_mV);
254 
255 /**
256  * @brief Test the #MXM_Convert()-function.
257  * @details This test-function is intended as a self-check. It tests whether
258  * the #MXM_Convert()-function computes the values as expected.
259  * @return #STD_OK on successful execution, otherwise #STD_NOT_OK
260  */
262 
263 /**
264  * @brief Extract a value from a single register.
265  * @details This function extracts a single value from a single register.
266  * The register has to be supplied as MSB and LSB. The bitmask has to
267  * be of type #MXM_REG_BM. The extracted value will be written into
268  * value.
269  *
270  * The function can only extract values from single registers
271  * (MSB and LSB)and does not handle values that span multiple
272  * registers.
273  * @param[in] lsb least significant byte of the register
274  * @param[in] msb most significant byte of the register
275  * @param[in] bitmask bitmask for the value
276  * @param[out] pValue pointer to a variable in which the value
277  * should be written
278  */
279 extern void MXM_ExtractValueFromRegister(uint8_t lsb, uint8_t msb, MXM_REG_BM bitmask, uint16_t *pValue);
280 
281 /**
282  * @brief Test #MXM_ExtractValueFromRegister().
283  * @details Self-check that tests whether #MXM_ExtractValueFromRegister() works
284  * as expected.
285  * @return #STD_OK if the self-check has passed successfully
286  */
288 
289 /**
290  * @brief Find Position of first set bit in bitmask
291  * @details Searches a bitmask starting from the lowest bit and returns the
292  * position of the first set bit.
293  * @param[in] bitmask bitmask that should be searched
294  * @return position of first set bit
295  */
296 extern uint8_t MXM_FirstSetBit(uint16_t bitmask);
297 
298 /**
299  * @brief Test #MXM_FirstSetBit().
300  * @details Tests the function #MXM_FirstSetBit() if it works as expected.
301  * @return #STD_OK if the self-check has passed successfully
302  */
304 
305 /**
306  * @brief convert a unipolar 14bit-value and shifts it into the 16bit-format
307  * @details Takes a value in the unipolar 14bit format and transforms it into
308  * a 16bit register entry for the monitoring IC (separated into LSB
309  * and MSB).
310  * @param[in] inputValue unipolar 14bit-value
311  * @param[out] lsb LSB in 16bit-format
312  * @param[out] msb MSB in 16bit-format
313  */
314 extern void MXM_Unipolar14BitInto16Bit(uint16_t inputValue, uint8_t *lsb, uint8_t *msb);
315 
316 /**
317  * @brief convert a voltage value into a unipolar 14bit value
318  * @details Takes a voltage value in mV together with a reference for fullscale
319  * values into a unipolar 14bit value.
320  * @param[in] voltage_mV voltage in mV
321  * @param[in] fullscaleReference_mV value of the fullscale in mV;
322  * typically 5000
323  * @return unipolar 14bit value for usage with
324  * #MXM_Unipolar14BitInto16Bit()
325  */
326 extern uint16_t MXM_VoltageIntoUnipolar14Bit(uint16_t voltage_mV, uint16_t fullscaleReference_mV);
327 
328 /**
329  * @brief Get the string and module number from a global module number
330  * @details Maxim driver knows only one string internally and maps on demand
331  * this one string onto several strings (for instances where several
332  * modules are in the same daisy-chain but belong to different
333  * strings).
334  *
335  * This function assumes that a string contains #BS_NR_OF_MODULES modules
336  * in #BS_NR_OF_STRINGS strings and that they are connected in
337  * a daisy-chain.
338  * @param[in] moduleNumber number of the module in the daisy-chain (starts with 0)
339  * @param[out] pStringNumber pointer where the string number will be written
340  * @param[out] pModuleNumberInString module number in the string
341  */
342 extern void MXM_ConvertModuleToString(
343  const uint16_t moduleNumber,
344  uint8_t *pStringNumber,
345  uint16_t *pModuleNumberInString);
346 
347 /*========== Externalized Static Functions Prototypes (Unit Test) ===========*/
348 
349 #endif /* FOXBMS__MXM_1785X_TOOLS_H_ */
MXM_INIT_GET_VERSION
@ MXM_INIT_GET_VERSION
Definition: mxm_1785x_tools.h:88
MXM_OP_SET_SCAN_STROBE
@ MXM_OP_SET_SCAN_STROBE
Definition: mxm_1785x_tools.h:121
MXM_STATEMACHINE_STATES_IDLE
@ MXM_STATEMACHINE_STATES_IDLE
Definition: mxm_1785x_tools.h:79
MXM_MONITORING_INSTANCE::mxmVoltageCellCounter
uint8_t mxmVoltageCellCounter
Definition: mxm_1785x_tools.h:199
MXM_FirstSetBitTest
STD_RETURN_TYPE_e must_check_return MXM_FirstSetBitTest(void)
Test MXM_FirstSetBit().
Definition: mxm_1785x_tools.c:85
MXM_INIT_I2C_CFG
@ MXM_INIT_I2C_CFG
Definition: mxm_1785x_tools.h:115
MXM_5X_INSTANCE
5x statemachine structure
Definition: mxm_battery_management.h:251
MXM_DATA_STORAGE
Definition: mxm_basic_defines.h:146
MXM_Convert
void MXM_Convert(uint8_t lsb, uint8_t msb, uint16_t *pTarget, MXM_CONVERSION_TYPE_e convType, uint32_t fullScaleReference_mV)
Convert a measurement value to a voltage value.
Definition: mxm_1785x_tools.c:98
MXM_MONITORING_INSTANCE::pInstance5X
MXM_5X_INSTANCE_s * pInstance5X
Definition: mxm_1785x_tools.h:206
MXM_SELFCHECK::crc
STD_RETURN_TYPE_e crc
Definition: mxm_1785x_tools.h:152
MXM_MONINTORING_STATE_e
enum MXM_MONITORING_STATE MXM_MONINTORING_STATE_e
MXM_CONVERSION_TYPE_e
enum MXM_CONVERSION_TYPE MXM_CONVERSION_TYPE_e
MXM_INIT_GET_ID2
@ MXM_INIT_GET_ID2
Definition: mxm_1785x_tools.h:90
MXM_SELFCHECK::addressSpaceChecker
STD_RETURN_TYPE_e addressSpaceChecker
Definition: mxm_1785x_tools.h:160
MXM_MODEL_ID_e
enum MXM_MODEL_ID MXM_MODEL_ID_e
Type of monitoring device.
MXM_INIT_GET_I2C_STAT2
@ MXM_INIT_GET_I2C_STAT2
Definition: mxm_1785x_tools.h:119
MXM_REGISTRY_ENTRY::model
MXM_MODEL_ID_e model
Definition: mxm_1785x_tools.h:172
MXM_MONITORING_INSTANCE
Definition: mxm_1785x_tools.h:188
MXM_SELFCHECK::parseVoltageReadall
STD_RETURN_TYPE_e parseVoltageReadall
Definition: mxm_1785x_tools.h:158
MXM_SELFCHECK
Definition: mxm_1785x_tools.h:151
MXM_INIT_ALRTUVEN
@ MXM_INIT_ALRTUVEN
Definition: mxm_1785x_tools.h:112
MXM_OP_BAL_EXIT
@ MXM_OP_BAL_EXIT
Definition: mxm_1785x_tools.h:138
MXM_MONITORING_INSTANCE::dcByte
MXM_DC_BYTE_e dcByte
Definition: mxm_1785x_tools.h:198
MXM_STATEMACHINE_STATES_MAXSTATE
@ MXM_STATEMACHINE_STATES_MAXSTATE
Definition: mxm_1785x_tools.h:81
MXM_INIT_BALEXP9
@ MXM_INIT_BALEXP9
Definition: mxm_1785x_tools.h:104
MXM_ExtractValueFromRegisterTest
STD_RETURN_TYPE_e must_check_return MXM_ExtractValueFromRegisterTest(void)
Test MXM_ExtractValueFromRegister().
Definition: mxm_1785x_tools.c:176
MXM_STATEMACHINE_OPERATION_STATES_e
MXM_STATEMACHINE_OPERATION_STATES_e
Definition: mxm_1785x_tools.h:85
MXM_OP_PINOPEN_GET_ALRT
@ MXM_OP_PINOPEN_GET_ALRT
Definition: mxm_1785x_tools.h:131
STD_RETURN_TYPE_e
enum STD_RETURN_TYPE STD_RETURN_TYPE_e
MXM_STATEMACHINE_STATES_INIT
@ MXM_STATEMACHINE_STATES_INIT
Definition: mxm_1785x_tools.h:77
MXM_MONITORING_STATE_PENDING
@ MXM_MONITORING_STATE_PENDING
Definition: mxm_1785x_tools.h:143
MXM_OP_PINOPEN_COMPSCAN
@ MXM_OP_PINOPEN_COMPSCAN
Definition: mxm_1785x_tools.h:129
MXM_INIT_I2C_PNTR
@ MXM_INIT_I2C_PNTR
Definition: mxm_1785x_tools.h:116
MXM_SELFCHECK::fmeaStatusASCI
STD_RETURN_TYPE_e fmeaStatusASCI
Definition: mxm_1785x_tools.h:162
MXM_OP_PINOPEN_PROCESS_OPENWIRE
@ MXM_OP_PINOPEN_PROCESS_OPENWIRE
Definition: mxm_1785x_tools.h:132
MXM_REGISTRY_ENTRY::deviceAddress
uint8_t deviceAddress
Definition: mxm_1785x_tools.h:171
MXM_STATEMACHINE_STATES_SELFCHECK_PRE_INIT
@ MXM_STATEMACHINE_STATES_SELFCHECK_PRE_INIT
Definition: mxm_1785x_tools.h:76
MXM_DC_BYTE_e
enum MXM_DC_BYTE MXM_DC_BYTE_e
mxm_register_map.h
Register map of the MAX1785x monitoring IC.
MXM_OP_PINOPEN_GET_SCAN_STROBE
@ MXM_OP_PINOPEN_GET_SCAN_STROBE
Definition: mxm_1785x_tools.h:130
MXM_MONITORING_INSTANCE::batteryCmdBuffer
MXM_5X_COMMAND_PAYLOAD_s batteryCmdBuffer
Definition: mxm_1785x_tools.h:202
MXM_INIT_BALSWDLY
@ MXM_INIT_BALSWDLY
Definition: mxm_1785x_tools.h:110
MXM_5X_STATE_REQUEST_STATUS_e
MXM_5X_STATE_REQUEST_STATUS_e
Request status of Battery Management Protocol states.
Definition: mxm_battery_management.h:229
mxm_cfg.h
Header for the configuration for the Maxim monitoring chip.
MXM_OP_BAL_CONTROL_SET_ALL
@ MXM_OP_BAL_CONTROL_SET_ALL
Definition: mxm_1785x_tools.h:136
MXM_OP_GET_ALRTSUM
@ MXM_OP_GET_ALRTSUM
Definition: mxm_1785x_tools.h:124
MXM_MONITORING_INSTANCE::rxBuffer
uint8_t rxBuffer[MXM_RX_BUFFER_LENGTH]
Definition: mxm_1785x_tools.h:223
MXM_INIT_I2C_GET_STAT1
@ MXM_INIT_I2C_GET_STAT1
Definition: mxm_1785x_tools.h:114
MXM_INIT_SET_FMEA2
@ MXM_INIT_SET_FMEA2
Definition: mxm_1785x_tools.h:120
MXM_INIT_BALEXP11
@ MXM_INIT_BALEXP11
Definition: mxm_1785x_tools.h:106
MXM_REGISTRY_ENTRY::siliconVersion
MXM_siliconVersion_e siliconVersion
Definition: mxm_1785x_tools.h:173
MXM_SELFCHECK::conv
STD_RETURN_TYPE_e conv
Definition: mxm_1785x_tools.h:153
MXM_REGISTRY_ENTRY::connected
bool connected
Definition: mxm_1785x_tools.h:170
MXM_OP_BAL_CONTROL_RESET_ALL
@ MXM_OP_BAL_CONTROL_RESET_ALL
Definition: mxm_1785x_tools.h:135
MXM_OP_PINOPEN_RESTORE_CURRENT_SOURCE_CONF
@ MXM_OP_PINOPEN_RESTORE_CURRENT_SOURCE_CONF
Definition: mxm_1785x_tools.h:133
MXM_ConvertTest
STD_RETURN_TYPE_e must_check_return MXM_ConvertTest(void)
Test the MXM_Convert()-function.
Definition: mxm_1785x_tools.c:127
MXM_MAXIMUM_NR_OF_MODULES
#define MXM_MAXIMUM_NR_OF_MODULES
Maximum number of modules.
Definition: mxm_basic_defines.h:73
MXM_OP_BAL_ENTRY
@ MXM_OP_BAL_ENTRY
Definition: mxm_1785x_tools.h:134
MXM_INIT_BALEXP1
@ MXM_INIT_BALEXP1
Definition: mxm_1785x_tools.h:96
MXM_VoltageIntoUnipolar14Bit
uint16_t MXM_VoltageIntoUnipolar14Bit(uint16_t voltage_mV, uint16_t fullscaleReference_mV)
convert a voltage value into a unipolar 14bit value
Definition: mxm_1785x_tools.c:216
MXM_ExtractValueFromRegister
void MXM_ExtractValueFromRegister(uint8_t lsb, uint8_t msb, MXM_REG_BM bitmask, uint16_t *pValue)
Extract a value from a single register.
Definition: mxm_1785x_tools.c:157
MXM_MONITORING_INSTANCE::state
MXM_STATEMACHINE_STATES_e state
Definition: mxm_1785x_tools.h:189
MXM_MONITORING_INSTANCE::stopRequested
bool stopRequested
Definition: mxm_1785x_tools.h:194
must_check_return
#define must_check_return
Allows functions to generate warnings in GCC for unused returns.
Definition: general.h:95
MXM_MONITORING_INSTANCE::openwireRequested
bool openwireRequested
Definition: mxm_1785x_tools.h:195
MXM_INIT_COMPOPNTHREG
@ MXM_INIT_COMPOPNTHREG
Definition: mxm_1785x_tools.h:113
MXM_RX_BUFFER_LENGTH
#define MXM_RX_BUFFER_LENGTH
Length of RX buffer.
Definition: mxm_1785x_tools.h:185
MXM_OP_PINOPEN_SET_CURRENT_SOURCES
@ MXM_OP_PINOPEN_SET_CURRENT_SOURCES
Definition: mxm_1785x_tools.h:128
MXM_INIT_MEASUREEN2
@ MXM_INIT_MEASUREEN2
Definition: mxm_1785x_tools.h:92
MXM_INIT_STATUS1
@ MXM_INIT_STATUS1
Definition: mxm_1785x_tools.h:87
MXM_INIT_UVTHSETREG
@ MXM_INIT_UVTHSETREG
Definition: mxm_1785x_tools.h:94
MXM_INIT_BALEXP13
@ MXM_INIT_BALEXP13
Definition: mxm_1785x_tools.h:108
MXM_OP_BAL_START
@ MXM_OP_BAL_START
Definition: mxm_1785x_tools.h:137
MXM_INIT_I2C_SEND
@ MXM_INIT_I2C_SEND
Definition: mxm_1785x_tools.h:118
MXM_INIT_ALRTOVEN
@ MXM_INIT_ALRTOVEN
Definition: mxm_1785x_tools.h:111
MXM_ConvertModuleToString
void MXM_ConvertModuleToString(const uint16_t moduleNumber, uint8_t *pStringNumber, uint16_t *pModuleNumberInString)
Get the string and module number from a global module number.
Definition: mxm_1785x_tools.c:224
MXM_INIT_BALEXP8
@ MXM_INIT_BALEXP8
Definition: mxm_1785x_tools.h:103
MXM_INIT_BALEXP7
@ MXM_INIT_BALEXP7
Definition: mxm_1785x_tools.h:102
MXM_INIT_GET_ID1
@ MXM_INIT_GET_ID1
Definition: mxm_1785x_tools.h:89
MXM_OP_PINOPEN_EXIT
@ MXM_OP_PINOPEN_EXIT
Definition: mxm_1785x_tools.h:127
MXM_SELFCHECK::firstSetBit
STD_RETURN_TYPE_e firstSetBit
Definition: mxm_1785x_tools.h:154
MXM_REG_BM
uint16_t MXM_REG_BM
Type for register access for monitoring ICs.
Definition: mxm_register_map.h:702
MXM_41B_INSTANCE
Struct for the state-variable of state-machine.
Definition: mxm_17841b.h:149
MXM_OP_GET_SCAN_STROBE
@ MXM_OP_GET_SCAN_STROBE
Definition: mxm_1785x_tools.h:122
MXM_INIT_BALEXP6
@ MXM_INIT_BALEXP6
Definition: mxm_1785x_tools.h:101
MXM_Unipolar14BitInto16Bit
void MXM_Unipolar14BitInto16Bit(uint16_t inputValue, uint8_t *lsb, uint8_t *msb)
convert a unipolar 14bit-value and shifts it into the 16bit-format
Definition: mxm_1785x_tools.c:205
MXM_STATEMACHINE_STATES
MXM_STATEMACHINE_STATES
States of the global Maxim state-machine.
Definition: mxm_1785x_tools.h:74
MXM_siliconVersion_e
enum MXM_siliconVersion MXM_siliconVersion_e
MXM_MONITORING_INSTANCE::allowStartup
bool allowStartup
Definition: mxm_1785x_tools.h:191
MXM_REGISTRY_ENTRY
Definition: mxm_1785x_tools.h:169
MXM_MONITORING_INSTANCE::operationRequested
bool operationRequested
Definition: mxm_1785x_tools.h:192
MXM_MONITORING_STATE
MXM_MONITORING_STATE
Definition: mxm_1785x_tools.h:142
MXM_MONITORING_INSTANCE::operationSubstate
MXM_STATEMACHINE_OPERATION_STATES_e operationSubstate
Definition: mxm_1785x_tools.h:190
MXM_FirstSetBit
uint8_t MXM_FirstSetBit(uint16_t bitmask)
Find Position of first set bit in bitmask.
Definition: mxm_1785x_tools.c:73
MXM_INIT_AUXGPIOCFG
@ MXM_INIT_AUXGPIOCFG
Definition: mxm_1785x_tools.h:93
MXM_INIT_BALEXP5
@ MXM_INIT_BALEXP5
Definition: mxm_1785x_tools.h:100
MXM_MONITORING_INSTANCE::localVoltages
MXM_DATA_STORAGE_s localVoltages
Local storage for cell-voltages.
Definition: mxm_1785x_tools.h:221
MXM_MONITORING_INSTANCE::firstMeasurementDone
bool firstMeasurementDone
Definition: mxm_1785x_tools.h:193
MXM_INIT_BALEXP3
@ MXM_INIT_BALEXP3
Definition: mxm_1785x_tools.h:98
MXM_INIT_I2C_WDATA2
@ MXM_INIT_I2C_WDATA2
Definition: mxm_1785x_tools.h:117
MXM_OP_GET_VOLTAGES
@ MXM_OP_GET_VOLTAGES
Definition: mxm_1785x_tools.h:123
MXM_MONITORING_INSTANCE_s
struct MXM_MONITORING_INSTANCE MXM_MONITORING_INSTANCE_s
MXM_MONITORING_INSTANCE::undervoltageAlert
bool undervoltageAlert
Definition: mxm_1785x_tools.h:196
MXM_REGISTRY_ENTRY::deviceID
uint32_t deviceID
Definition: mxm_1785x_tools.h:174
mxm_basic_defines.h
Basic defines for the complete Maxim driver.
MXM_INIT_OVTHSETREG
@ MXM_INIT_OVTHSETREG
Definition: mxm_1785x_tools.h:95
MXM_SELFCHECK_s
struct MXM_SELFCHECK MXM_SELFCHECK_s
MXM_INIT_BALEXP4
@ MXM_INIT_BALEXP4
Definition: mxm_1785x_tools.h:99
MXM_STATEMACHINE_STATES_e
enum MXM_STATEMACHINE_STATES MXM_STATEMACHINE_STATES_e
States of the global Maxim state-machine.
MXM_MONITORING_INSTANCE::pInstance41B
MXM_41B_INSTANCE_s * pInstance41B
Definition: mxm_1785x_tools.h:205
MXM_MONITORING_INSTANCE::highest5xDevice
uint8_t highest5xDevice
Definition: mxm_1785x_tools.h:200
MXM_5X_COMMAND_PAYLOAD_s
Payload command.
Definition: mxm_battery_management.h:240
MXM_MONITORING_INSTANCE::requestStatus5x
MXM_5X_STATE_REQUEST_STATUS_e requestStatus5x
Definition: mxm_1785x_tools.h:201
MXM_INIT_DEVCFG1
@ MXM_INIT_DEVCFG1
Definition: mxm_1785x_tools.h:86
MXM_STATEMACHINE_STATES_UNINITIALIZED
@ MXM_STATEMACHINE_STATES_UNINITIALIZED
Definition: mxm_1785x_tools.h:75
MXM_INIT_BALEXP2
@ MXM_INIT_BALEXP2
Definition: mxm_1785x_tools.h:97
MXM_STATEMACHINE_STATES_OPERATION
@ MXM_STATEMACHINE_STATES_OPERATION
Definition: mxm_1785x_tools.h:80
MXM_INIT_MEASUREEN1
@ MXM_INIT_MEASUREEN1
Definition: mxm_1785x_tools.h:91
MXM_MONITORING_INSTANCE::selfCheck
MXM_SELFCHECK_s selfCheck
Definition: mxm_1785x_tools.h:204
MXM_REGISTRY_ENTRY_s
struct MXM_REGISTRY_ENTRY MXM_REGISTRY_ENTRY_s
MXM_OP_PINOPEN_ENTRY
@ MXM_OP_PINOPEN_ENTRY
Definition: mxm_1785x_tools.h:126
MXM_INIT_BALEXP10
@ MXM_INIT_BALEXP10
Definition: mxm_1785x_tools.h:105
MXM_OP_PARSE_VOLTAGES_INTO_DB
@ MXM_OP_PARSE_VOLTAGES_INTO_DB
Definition: mxm_1785x_tools.h:125
MXM_INIT_BALEXP14
@ MXM_INIT_BALEXP14
Definition: mxm_1785x_tools.h:109
MXM_MONITORING_INSTANCE::resultSelfCheck
STD_RETURN_TYPE_e resultSelfCheck
Definition: mxm_1785x_tools.h:203
MXM_STATEMACHINE_STATES_SELFCHECK_POST_INIT
@ MXM_STATEMACHINE_STATES_SELFCHECK_POST_INIT
Definition: mxm_1785x_tools.h:78
MXM_INIT_BALEXP12
@ MXM_INIT_BALEXP12
Definition: mxm_1785x_tools.h:107
mxm_battery_management.h
Headers for the driver for the MAX17841B ASCI and MAX1785x monitoring chip.
MXM_SELFCHECK::extractValueFromRegister
STD_RETURN_TYPE_e extractValueFromRegister
Definition: mxm_1785x_tools.h:156
MXM_MONITORING_INSTANCE::registry
MXM_REGISTRY_ENTRY_s registry[MXM_MAXIMUM_NR_OF_MODULES]
Definition: mxm_1785x_tools.h:222
MXM_MONITORING_STATE_PASS
@ MXM_MONITORING_STATE_PASS
Definition: mxm_1785x_tools.h:144
MXM_MONITORING_STATE_FAIL
@ MXM_MONITORING_STATE_FAIL
Definition: mxm_1785x_tools.h:145