foxBMS - Unit Tests  1.4.0
The foxBMS Unit Tests API Documentation
nxp_mc33775a_cfg.h File Reference

Header for the configuration for the MC33775A monitoring chip. More...

#include "battery_system_cfg.h"
#include "nxp_afe_dma.h"
#include "nxp_mc33775a_defs.h"
#include "spi.h"
Include dependency graph for nxp_mc33775a_cfg.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define N775_I2C_NR_BYTES_FOR_MUX_WRITE   (4u)
 
#define N775_I2C_NR_BYTES_TO_SWITCH_TO_READ_FOR_UX_READ   (2u)
 
#define N775_USE_NOTIFICATIONS   (true)
 
#define N775_NOTIFICATION_TX_INDEX   (1u)
 
#define N775_NOTIFICATION_RX_INDEX   (2u)
 
#define N775_NO_NOTIFIED_VALUE   (0x0u)
 
#define N775_TX_NOTIFIED_VALUE   (0x50u)
 
#define N775_RX_NOTIFIED_VALUE   (0x60u)
 
#define N775_NOTIFICATION_TX_TIMEOUT_ms   (1u)
 
#define N775_NOTIFICATION_RX_TIMEOUT_ms   (2u)
 
#define N775_N_N775   (BS_NR_OF_MODULES_PER_STRING)
 
#define N775_NUMBER_OF_N775_PER_MODULE   (1u)
 
#define N775_TX_MESSAGE_LENGTH   (7u)
 
#define N775_RX_MESSAGE_LENGTH   (4u)
 
#define N775_MAX_NUMBER_OF_VOLTAGES   (14u)
 
#define N775_TRANSMISSION_TIMEOUT   (10u)
 
#define N775_STATEMACH_SHORTTIME   (1u)
 
#define N775_TWAKECOM_MS   (3u)
 
#define N775_TDWAKE_MS   (4u)
 
#define N775_TIME_DAISYCHAIN_WAKEUP_MS   (N775_N_N775 * (N775_TWAKECOM_MS + N775_TDWAKE_MS))
 
#define N775_TIME_BETWEEN_WAKEUP_MS   (4u)
 
#define N775_TIME_AFTER_ENUMERATION_MS   (1u)
 
#define N775_TRANSMIT_SPIERRLIMIT   (3u)
 
#define N775_MAX_N_BYTES_FOR_DATA_RECEPTION   (N775_TX_MESSAGE_LENGTH * N775_MAX_NUMBER_OF_VOLTAGES)
 
#define N775_SendData(txbuf, rxbuf, length)   SPI_TransmitReceiveDataDma(&spi_nxp775InterfaceTx[0], txbuf, rxbuf, length)
 

Functions

int16_t N775_ConvertVoltagesToTemperatures (uint16_t adcVoltage_mV)
 converts a raw voltage from multiplexer to a temperature value in deci °C. More...
 

Variables

N775_MUX_CH_CFG_s n775_muxSequence [N775_MUX_SEQUENCE_LENGTH]
 

Detailed Description

Header for the configuration for the MC33775A monitoring chip.

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-05-08 (date of creation)
Updated
2022-07-28 (date of last update)
Version
v1.4.0
Prefix
N775

Definition in file nxp_mc33775a_cfg.h.

Macro Definition Documentation

◆ N775_I2C_NR_BYTES_FOR_MUX_WRITE

#define N775_I2C_NR_BYTES_FOR_MUX_WRITE   (4u)

Number of bytes to be sent over I2C to write and read I2C mux register in order to choose channel

Definition at line 68 of file nxp_mc33775a_cfg.h.

◆ N775_I2C_NR_BYTES_TO_SWITCH_TO_READ_FOR_UX_READ

#define N775_I2C_NR_BYTES_TO_SWITCH_TO_READ_FOR_UX_READ   (2u)

Number of bytes in I2C transaction after which the I2C bus should change to read

Definition at line 71 of file nxp_mc33775a_cfg.h.

◆ N775_MAX_N_BYTES_FOR_DATA_RECEPTION

#define N775_MAX_N_BYTES_FOR_DATA_RECEPTION   (N775_TX_MESSAGE_LENGTH * N775_MAX_NUMBER_OF_VOLTAGES)

Max number of Bytes to be received from daisy-chain This limit is not due to the hardware. It is only to set the length of the receive buffer for DMA.

Definition at line 184 of file nxp_mc33775a_cfg.h.

◆ N775_MAX_NUMBER_OF_VOLTAGES

#define N775_MAX_NUMBER_OF_VOLTAGES   (14u)

775A maximum number of cell voltages that can be measured.

Definition at line 133 of file nxp_mc33775a_cfg.h.

◆ N775_N_N775

#define N775_N_N775   (BS_NR_OF_MODULES_PER_STRING)

Number of used N775-ICs

Definition at line 113 of file nxp_mc33775a_cfg.h.

◆ N775_NO_NOTIFIED_VALUE

#define N775_NO_NOTIFIED_VALUE   (0x0u)

Default notification value, signals that no notification was received

Definition at line 90 of file nxp_mc33775a_cfg.h.

◆ N775_NOTIFICATION_RX_INDEX

#define N775_NOTIFICATION_RX_INDEX   (2u)

Index used for FreeRTOS notification sent when RX DMA interrupt comes

Definition at line 86 of file nxp_mc33775a_cfg.h.

◆ N775_NOTIFICATION_RX_TIMEOUT_ms

#define N775_NOTIFICATION_RX_TIMEOUT_ms   (2u)

Time in ms to wait for DMA RX notification, after this delay the transaction is considered to have failed

Definition at line 108 of file nxp_mc33775a_cfg.h.

◆ N775_NOTIFICATION_TX_INDEX

#define N775_NOTIFICATION_TX_INDEX   (1u)

Index used for FreeRTOS notification sent when TX DMA interrupt comes

Definition at line 82 of file nxp_mc33775a_cfg.h.

◆ N775_NOTIFICATION_TX_TIMEOUT_ms

#define N775_NOTIFICATION_TX_TIMEOUT_ms   (1u)

Time in ms to wait for DMA TX notification, after this delay the transaction is considered to have failed

Definition at line 103 of file nxp_mc33775a_cfg.h.

◆ N775_NUMBER_OF_N775_PER_MODULE

#define N775_NUMBER_OF_N775_PER_MODULE   (1u)

Number of N775-ICs per battery module

Definition at line 118 of file nxp_mc33775a_cfg.h.

◆ N775_RX_MESSAGE_LENGTH

#define N775_RX_MESSAGE_LENGTH   (4u)

775A Rx message length in bytes.

Definition at line 128 of file nxp_mc33775a_cfg.h.

◆ N775_RX_NOTIFIED_VALUE

#define N775_RX_NOTIFIED_VALUE   (0x60u)

Notification value sent when RX DMA interrupt comes

Definition at line 98 of file nxp_mc33775a_cfg.h.

◆ N775_SendData

#define N775_SendData (   txbuf,
  rxbuf,
  length 
)    SPI_TransmitReceiveDataDma(&spi_nxp775InterfaceTx[0], txbuf, rxbuf, length)

Transmit functions

Definition at line 189 of file nxp_mc33775a_cfg.h.

◆ N775_STATEMACH_SHORTTIME

#define N775_STATEMACH_SHORTTIME   (1u)

N775 statemachine short time definition in ms

Definition at line 144 of file nxp_mc33775a_cfg.h.

◆ N775_TDWAKE_MS

#define N775_TDWAKE_MS   (4u)

N775 Time between two consecutive wake-up messages in ms 4ms in data sheet

Definition at line 156 of file nxp_mc33775a_cfg.h.

◆ N775_TIME_AFTER_ENUMERATION_MS

#define N775_TIME_AFTER_ENUMERATION_MS   (1u)

N775 time after enumeraiton in ms

Definition at line 171 of file nxp_mc33775a_cfg.h.

◆ N775_TIME_BETWEEN_WAKEUP_MS

#define N775_TIME_BETWEEN_WAKEUP_MS   (4u)

N775 time between two wake up commands in ms

Definition at line 166 of file nxp_mc33775a_cfg.h.

◆ N775_TIME_DAISYCHAIN_WAKEUP_MS

#define N775_TIME_DAISYCHAIN_WAKEUP_MS   (N775_N_N775 * (N775_TWAKECOM_MS + N775_TDWAKE_MS))

N775 time for daisy-chain to wake-up in ms

Definition at line 161 of file nxp_mc33775a_cfg.h.

◆ N775_TRANSMISSION_TIMEOUT

#define N775_TRANSMISSION_TIMEOUT   (10u)

Timeout in milliseconds added to the transmission time for interrupt-based SPI transmission.

Definition at line 139 of file nxp_mc33775a_cfg.h.

◆ N775_TRANSMIT_SPIERRLIMIT

#define N775_TRANSMIT_SPIERRLIMIT   (3u)

Maximum number of re-tries in case of SPI error during the communication with daisy chain before going into error state

Definition at line 177 of file nxp_mc33775a_cfg.h.

◆ N775_TWAKECOM_MS

#define N775_TWAKECOM_MS   (3u)

N775 Maximum time from wakeup event to possible communication in ms 2.4ms in data sheet

Definition at line 150 of file nxp_mc33775a_cfg.h.

◆ N775_TX_MESSAGE_LENGTH

#define N775_TX_MESSAGE_LENGTH   (7u)

775A Tx message length in bytes.

Definition at line 123 of file nxp_mc33775a_cfg.h.

◆ N775_TX_NOTIFIED_VALUE

#define N775_TX_NOTIFIED_VALUE   (0x50u)

Notification value sent when TX DMA interrupt comes

Definition at line 94 of file nxp_mc33775a_cfg.h.

◆ N775_USE_NOTIFICATIONS

#define N775_USE_NOTIFICATIONS   (true)

If false, driver runs blocking for SPI transactions If true, driver blocks task and waits for notification for SPI transaction

Definition at line 77 of file nxp_mc33775a_cfg.h.

Function Documentation

◆ N775_ConvertVoltagesToTemperatures()

int16_t N775_ConvertVoltagesToTemperatures ( uint16_t  adcVoltage_mV)

converts a raw voltage from multiplexer to a temperature value in deci °C.

The temperatures are read from NTC elements via voltage dividers. This function implements the look-up table between voltage and temperature, taking into account the NTC characteristics and the voltage divider.

Parameters
adcVoltage_mVvoltage read from the multiplexer in mV
Returns
temperature value in deci °C

Definition at line 186 of file nxp_mc33775a_cfg.c.

Here is the call graph for this function:

Variable Documentation

◆ n775_muxSequence

N775_MUX_CH_CFG_s n775_muxSequence[N775_MUX_SEQUENCE_LENGTH]
extern

Multiplexer measurement sequence

Default multiplexer measurement sequence Must be adapted to the application

Definition at line 70 of file nxp_mc33775a_cfg.c.