foxBMS - Unit Tests  1.5.0
The foxBMS Unit Tests API Documentation
nxp_mc33775a_defs.h File Reference

Definitions for the driver for the MC33775A analog front-end. More...

#include "database.h"
#include "spi.h"
#include <stdint.h>
Include dependency graph for nxp_mc33775a_defs.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  N775_ERRORTABLE_s
 
struct  N775_SUPPLY_CURRENT_s
 
struct  N775_MUX_CH_CFG_s
 
struct  N775_DATAPTR_s
 
struct  N775_ERROR_s
 
struct  N775_CONFIG_s
 
struct  N775_STATE_s
 
struct  N775_MESSAGE_s
 

Macros

#define N775_USE_MUX_FOR_TEMP   (true)
 
#define N775_CHECK_MUX_STATE   (true)
 
#define N775_CHECK_SUPPLY_CURRENT   (false)
 
#define N775_BROADCAST_ADDRESS   (63u)
 
#define N775_WAKEUP_TIME_MS   (3u)
 
#define N775_TIMEOUT_TO_SLEEP_10MS   (200u)
 
#define N775_TIMEOUT_ENABLED   (0u)
 
#define N775_TIMEOUT_DISABLED   (0x5Au)
 
#define N775_TIMEOUT_SWITCH   (N775_TIMEOUT_ENABLED)
 
#define N775_TIME_AFTER_MEASUREMENT_START_MS   (5u)
 
#define N775_DEFAULT_CHAIN_ADDRESS   (1u)
 
#define N775_MEASUREMENT_CAPTURE_TIME_MS   (5u + 1u)
 
#define N775_MEASUREMENT_READY_TIME_MS   (1u)
 
#define N775_INVALID_REGISTER_VALUE   (0x8000u)
 
#define N775_MUX_SEQUENCE_LENGTH   (8u)
 
#define N775_BALPAUSELEN_10US   (100u)
 
#define N775_ADG728_ADDRESS_UPPERBITS   (0x98u)
 
#define N775_I2C_READ   (1u)
 
#define N775_I2C_WRITE   (0u)
 
#define N775_I2C_DUMMY_BYTE   (0x0u)
 
#define N775_MUXED_TEMP_GPIO_POSITION   (0u)
 
#define N775_GLOBAL_BALANCING_TIMER   (0xFFFFu)
 
#define N775_PRE_BALANCING_TIMER   (0x0u)
 
#define N775_ALL_CHANNEL_BALANCING_TIMER   (0xFFFFu)
 
#define N775_GLOBAL_BALANCING_TIMER_VALUE_SET_TO_MAX_AGAIN   (0x1000u)
 
#define N775_FLAG_READY_TRIES   (5u)
 
#define N775_I2C_FINISHED_TIMEOUT_ms   (50u)
 

Enumerations

enum  N775_STATEMACH_e {
  N775_STATEMACH_UNINITIALIZED , N775_STATEMACH_INITIALIZATION , N775_STATEMACH_WAKEUP , N775_STATEMACH_ENUMERATE ,
  N775_STATEMACH_INITIALIZED , N775_STATEMACH_IDLE , N775_STATEMACH_STARTMEAS , N775_STATEMACH_READVOLTAGE ,
  N775_STATEMACH_BALANCECONTROL
}
 
enum  N775_STATEMACH_SUB_e {
  N775_ENTRY , N775_SECOND_WAKEUP , N775_CHECK_ENUMERATION , N775_ERROR_ENTRY ,
  N775_ERROR_PROCESSED
}
 
enum  N775_STATEMACH_UNINITIALIZED_SUB_e { N775_ENTRY_UNINITIALIZED = 0 }
 
enum  N775_STATEMACH_INITIALIZATION_SUB_e {
  N775_ENTRY_INITIALIZATION = 0 , N775_START_INIT_INITIALIZATION = 1 , N775_RE_ENTRY_INITIALIZATION = 2 , N775_READ_INITIALIZATION_REGISTER = 3 ,
  N775_CHECK_INITIALIZATION = 4 , N775_EXIT_INITIALIZATION = 5
}
 
enum  N775_STATE_REQUEST_e { N775_STATE_INITIALIZATION_REQUEST , N775_STATE_NO_REQUEST }
 
enum  N775_RETURN_TYPE_e {
  N775_OK = 0 , N775_BUSY_OK = 1 , N775_REQUEST_PENDING = 2 , N775_ILLEGAL_REQUEST = 3 ,
  N775_SPI_ERROR = 4 , N775_PEC_ERROR = 5 , N775_MUX_ERROR = 6 , N775_INIT_ERROR = 7 ,
  N775_OK_FROM_ERROR = 8 , N775_GENERAL_ERROR = 20 , N775_ALREADY_INITIALIZED = 30 , N775_ILLEGAL_TASK_TYPE = 99
}
 
enum  N775_REUSE_MODE_e { N775_NOT_REUSED = 0 , N775_REUSE_READ_VOLTAGE_FOR_ADOW_PUP = 1 , N775_REUSE_READ_VOLTAGE_FOR_ADOW_PDOWN = 2 }
 
enum  N775_PORT_EXPANDER_TI_DIRECTION_e { N775_PORT_EXPANDER_TI_OUTPUT = 0x0 , N775_PORT_EXPANDER_TI_INPUT = 0xFF }
 

Detailed Description

Definitions for the driver for the MC33775A analog front-end.

SPDX-License-Identifier: BSD-3-Clause

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

We kindly request you to use one or more of the following phrases to refer to foxBMS in your hardware, software, documentation or advertising materials:

  • ″This product uses parts of foxBMS®″
  • ″This product includes parts of foxBMS®″
  • ″This product is derived from foxBMS®″
Author
foxBMS Team
Date
2020-09-01 (date of creation)
Updated
2023-02-03 (date of last update)
Version
v1.5.0
Prefix
N775

Definition in file nxp_mc33775a_defs.h.

Macro Definition Documentation

◆ N775_ADG728_ADDRESS_UPPERBITS

#define N775_ADG728_ADDRESS_UPPERBITS   (0x98u)

Upper bits of ADG728 mux address byte Set to 0: bit2, bit1 (address), bit0 (R/W)

Definition at line 107 of file nxp_mc33775a_defs.h.

◆ N775_ALL_CHANNEL_BALANCING_TIMER

#define N775_ALL_CHANNEL_BALANCING_TIMER   (0xFFFFu)

Definition at line 121 of file nxp_mc33775a_defs.h.

◆ N775_BALPAUSELEN_10US

#define N775_BALPAUSELEN_10US   (100u)

Definition at line 102 of file nxp_mc33775a_defs.h.

◆ N775_BROADCAST_ADDRESS

#define N775_BROADCAST_ADDRESS   (63u)

Definition at line 76 of file nxp_mc33775a_defs.h.

◆ N775_CHECK_MUX_STATE

#define N775_CHECK_MUX_STATE   (true)

Definition at line 72 of file nxp_mc33775a_defs.h.

◆ N775_CHECK_SUPPLY_CURRENT

#define N775_CHECK_SUPPLY_CURRENT   (false)

Definition at line 74 of file nxp_mc33775a_defs.h.

◆ N775_DEFAULT_CHAIN_ADDRESS

#define N775_DEFAULT_CHAIN_ADDRESS   (1u)

Definition at line 90 of file nxp_mc33775a_defs.h.

◆ N775_FLAG_READY_TRIES

#define N775_FLAG_READY_TRIES   (5u)

Definition at line 125 of file nxp_mc33775a_defs.h.

◆ N775_GLOBAL_BALANCING_TIMER

#define N775_GLOBAL_BALANCING_TIMER   (0xFFFFu)

Definition at line 117 of file nxp_mc33775a_defs.h.

◆ N775_GLOBAL_BALANCING_TIMER_VALUE_SET_TO_MAX_AGAIN

#define N775_GLOBAL_BALANCING_TIMER_VALUE_SET_TO_MAX_AGAIN   (0x1000u)

Definition at line 123 of file nxp_mc33775a_defs.h.

◆ N775_I2C_DUMMY_BYTE

#define N775_I2C_DUMMY_BYTE   (0x0u)

Definition at line 113 of file nxp_mc33775a_defs.h.

◆ N775_I2C_FINISHED_TIMEOUT_ms

#define N775_I2C_FINISHED_TIMEOUT_ms   (50u)

Definition at line 128 of file nxp_mc33775a_defs.h.

◆ N775_I2C_READ

#define N775_I2C_READ   (1u)

Definition at line 109 of file nxp_mc33775a_defs.h.

◆ N775_I2C_WRITE

#define N775_I2C_WRITE   (0u)

Definition at line 111 of file nxp_mc33775a_defs.h.

◆ N775_INVALID_REGISTER_VALUE

#define N775_INVALID_REGISTER_VALUE   (0x8000u)

Definition at line 97 of file nxp_mc33775a_defs.h.

◆ N775_MEASUREMENT_CAPTURE_TIME_MS

#define N775_MEASUREMENT_CAPTURE_TIME_MS   (5u + 1u)

Definition at line 93 of file nxp_mc33775a_defs.h.

◆ N775_MEASUREMENT_READY_TIME_MS

#define N775_MEASUREMENT_READY_TIME_MS   (1u)

Definition at line 95 of file nxp_mc33775a_defs.h.

◆ N775_MUX_SEQUENCE_LENGTH

#define N775_MUX_SEQUENCE_LENGTH   (8u)

Definition at line 99 of file nxp_mc33775a_defs.h.

◆ N775_MUXED_TEMP_GPIO_POSITION

#define N775_MUXED_TEMP_GPIO_POSITION   (0u)

Definition at line 115 of file nxp_mc33775a_defs.h.

◆ N775_PRE_BALANCING_TIMER

#define N775_PRE_BALANCING_TIMER   (0x0u)

Definition at line 119 of file nxp_mc33775a_defs.h.

◆ N775_TIME_AFTER_MEASUREMENT_START_MS

#define N775_TIME_AFTER_MEASUREMENT_START_MS   (5u)

Definition at line 88 of file nxp_mc33775a_defs.h.

◆ N775_TIMEOUT_DISABLED

#define N775_TIMEOUT_DISABLED   (0x5Au)

Definition at line 84 of file nxp_mc33775a_defs.h.

◆ N775_TIMEOUT_ENABLED

#define N775_TIMEOUT_ENABLED   (0u)

Definition at line 82 of file nxp_mc33775a_defs.h.

◆ N775_TIMEOUT_SWITCH

#define N775_TIMEOUT_SWITCH   (N775_TIMEOUT_ENABLED)

Definition at line 86 of file nxp_mc33775a_defs.h.

◆ N775_TIMEOUT_TO_SLEEP_10MS

#define N775_TIMEOUT_TO_SLEEP_10MS   (200u)

Definition at line 80 of file nxp_mc33775a_defs.h.

◆ N775_USE_MUX_FOR_TEMP

#define N775_USE_MUX_FOR_TEMP   (true)

Definition at line 70 of file nxp_mc33775a_defs.h.

◆ N775_WAKEUP_TIME_MS

#define N775_WAKEUP_TIME_MS   (3u)

Definition at line 78 of file nxp_mc33775a_defs.h.

Enumeration Type Documentation

◆ N775_PORT_EXPANDER_TI_DIRECTION_e

TI port expander IO direction (input or output)

Enumerator
N775_PORT_EXPANDER_TI_OUTPUT 
N775_PORT_EXPANDER_TI_INPUT 

Definition at line 276 of file nxp_mc33775a_defs.h.

◆ N775_RETURN_TYPE_e

Possible return values when state requests are made to the N775 statemachine

Enumerator
N775_OK 

N775 --> ok

N775_BUSY_OK 

N775 under load --> ok

N775_REQUEST_PENDING 

requested to be executed

N775_ILLEGAL_REQUEST 

Request can not be executed

N775_SPI_ERROR 

Error state: Source: SPI

N775_PEC_ERROR 

Error state: Source: PEC

N775_MUX_ERROR 

Error state: Source: MUX

N775_INIT_ERROR 

Error state: Source: Initialization

N775_OK_FROM_ERROR 

Return from error --> ok

N775_GENERAL_ERROR 

General error state

N775_ALREADY_INITIALIZED 

Initialization of N775 already finished

N775_ILLEGAL_TASK_TYPE 

Illegal

Definition at line 199 of file nxp_mc33775a_defs.h.

◆ N775_REUSE_MODE_e

Enumerator
N775_NOT_REUSED 
N775_REUSE_READ_VOLTAGE_FOR_ADOW_PUP 
N775_REUSE_READ_VOLTAGE_FOR_ADOW_PDOWN 

Definition at line 269 of file nxp_mc33775a_defs.h.

◆ N775_STATE_REQUEST_e

State requests for the N775 statemachine

Enumerator
N775_STATE_INITIALIZATION_REQUEST 
N775_STATE_NO_REQUEST 

Definition at line 191 of file nxp_mc33775a_defs.h.

◆ N775_STATEMACH_e

States of the N775 state machine

Enumerator
N775_STATEMACH_UNINITIALIZED 
N775_STATEMACH_INITIALIZATION 
N775_STATEMACH_WAKEUP 
N775_STATEMACH_ENUMERATE 
N775_STATEMACH_INITIALIZED 
N775_STATEMACH_IDLE 
N775_STATEMACH_STARTMEAS 
N775_STATEMACH_READVOLTAGE 
N775_STATEMACH_BALANCECONTROL 

Definition at line 153 of file nxp_mc33775a_defs.h.

◆ N775_STATEMACH_INITIALIZATION_SUB_e

Substates for the initialization state

Enumerator
N775_ENTRY_INITIALIZATION 
N775_START_INIT_INITIALIZATION 
N775_RE_ENTRY_INITIALIZATION 
N775_READ_INITIALIZATION_REGISTER 
N775_CHECK_INITIALIZATION 
N775_EXIT_INITIALIZATION 

Definition at line 180 of file nxp_mc33775a_defs.h.

◆ N775_STATEMACH_SUB_e

General substates

Enumerator
N775_ENTRY 
N775_SECOND_WAKEUP 
N775_CHECK_ENUMERATION 
N775_ERROR_ENTRY 
N775_ERROR_PROCESSED 

Definition at line 166 of file nxp_mc33775a_defs.h.

◆ N775_STATEMACH_UNINITIALIZED_SUB_e

Substates for the uninitialized state

Enumerator
N775_ENTRY_UNINITIALIZED 

Initialize-sequence

Definition at line 175 of file nxp_mc33775a_defs.h.