foxBMS-UnitTests  1.0.0
The foxBMS Unit Tests API Documentation
n775_cfg.h File Reference

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

#include "battery_system_cfg.h"
#include "n775_defs.h"
#include "nxp_mic_dma.h"
#include "spi.h"
Include dependency graph for n775_cfg.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define N775_N_N775   (BS_NR_OF_MODULES)
 
#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_nxp775Interface, txbuf, rxbuf, length)
 
#define N775_SPI_HANDLE   &spi_devices[0]
 
#define N775_SPI_INSTANCE   *N775_SPI_HANDLE.Instance
 
#define N775_SPI_PRESCALER   *N775_SPI_HANDLE.Init.BaudRatePrescaler
 

Functions

float N775_Convert_MuxVoltages_to_Temperatures (float v_adc_V)
 converts a raw voltage from multiplexer to a temperature value in Celsius. More...
 

Variables

const uint8_t n775_voltage_input_used [BS_MAX_SUPPORTED_CELLS]
 

Detailed Description

Header for the configuration for the MC33775A monitoring chip.

BSD 3-Clause License 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
2021-03-24 (date of last update)
Prefix
N775

Definition in file n775_cfg.h.

Macro Definition Documentation

◆ 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 151 of file n775_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 89 of file n775_cfg.h.

◆ N775_N_N775

#define N775_N_N775   (BS_NR_OF_MODULES)

Number of used N775-ICs

Definition at line 69 of file n775_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 74 of file n775_cfg.h.

◆ N775_RX_MESSAGE_LENGTH

#define N775_RX_MESSAGE_LENGTH   (4u)

775A Rx message length in bytes.

Definition at line 84 of file n775_cfg.h.

◆ N775_SendData

#define N775_SendData (   txbuf,
  rxbuf,
  length 
)    SPI_TransmitReceiveDataDma(&spi_nxp775Interface, txbuf, rxbuf, length)

Transmit functions

Definition at line 156 of file n775_cfg.h.

◆ N775_SPI_HANDLE

#define N775_SPI_HANDLE   &spi_devices[0]

SPI1 is used for communication with N775

Definition at line 101 of file n775_cfg.h.

◆ N775_SPI_INSTANCE

#define N775_SPI_INSTANCE   *N775_SPI_HANDLE.Instance

SPI1 is used for communication with N775

Definition at line 103 of file n775_cfg.h.

◆ N775_SPI_PRESCALER

#define N775_SPI_PRESCALER   *N775_SPI_HANDLE.Init.BaudRatePrescaler

SPI1 is used for communication with N775

Definition at line 105 of file n775_cfg.h.

◆ N775_STATEMACH_SHORTTIME

#define N775_STATEMACH_SHORTTIME   (1u)

N775 statemachine short time definition in ms

Definition at line 111 of file n775_cfg.h.

◆ N775_TDWAKE_MS

#define N775_TDWAKE_MS   (4u)

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

Definition at line 123 of file n775_cfg.h.

◆ N775_TIME_AFTER_ENUMERATION_MS

#define N775_TIME_AFTER_ENUMERATION_MS   (1u)

N775 time after enumeraiton in ms

Definition at line 138 of file n775_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 133 of file n775_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 128 of file n775_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 95 of file n775_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 144 of file n775_cfg.h.

◆ N775_TWAKECOM_MS

#define N775_TWAKECOM_MS   (3u)

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

Definition at line 117 of file n775_cfg.h.

◆ N775_TX_MESSAGE_LENGTH

#define N775_TX_MESSAGE_LENGTH   (7u)

775A Tx message length in bytes.

Definition at line 79 of file n775_cfg.h.

Function Documentation

◆ N775_Convert_MuxVoltages_to_Temperatures()

float N775_Convert_MuxVoltages_to_Temperatures ( float  v_adc_V)

converts a raw voltage from multiplexer to a temperature value in Celsius.

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
v_adc_Vvoltage read from the multiplexer in V
Returns
temperature temperature value in deci °C

Definition at line 84 of file n775_cfg.c.

Variable Documentation

◆ n775_voltage_input_used

const uint8_t n775_voltage_input_used[BS_MAX_SUPPORTED_CELLS]
extern

Lookup table to indicate which voltage inpus are used

Definition at line 62 of file n775_cfg.c.