foxBMS - Unit Tests  1.5.0
The foxBMS Unit Tests API Documentation
bender_iso165c.c File Reference

Driver for the insulation monitoring. More...

#include "bender_iso165c.h"
#include "database_cfg.h"
#include "can.h"
#include "can_cfg_rx-message-definitions.h"
#include "can_cfg_tx-message-definitions.h"
#include "can_helper.h"
#include "database.h"
#include "ftask.h"
#include <stdbool.h>
#include <stdint.h>
Include dependency graph for bender_iso165c.c:

Go to the source code of this file.

Data Structures

struct  I165C_INITIALIZATION_STATE_s
 
struct  I165C_ENABLE_STATE_s
 
struct  I165C_RUNNING_STATE_s
 
struct  I165C_DISABLE_STATE_s
 

Macros

#define I165C_FSM_SHORT_TIME   (1u)
 

Enumerations

enum  I165C_FSM_INITIALIZATION_STATES_e {
  I165C_FSM_STATE_INITIALIZATION_DUMMY , I165C_FSM_STATE_INITIALIZATION_HAS_NEVER_RUN , I165C_FSM_STATE_INITIALIZATION_UNLOCK_WAIT_ACK , I165C_FSM_STATE_INITIALIZATION_CHECK_MEASUREMENT_STATE ,
  I165C_FSM_STATE_INITIALIZATION_ENABLE_MEASUREMENT_WAIT_ACK , I165C_FSM_STATE_INITIALIZATION_REQUEST_HV_RELAY_OPENING , I165C_FSM_STATE_INITIALIZATION_REQUEST_NEGATIVE_HV_RELAY_STATE , I165C_FSM_STATE_INITIALIZATION_CHECK_NEGATIVE_HV_RELAY_STATE ,
  I165C_FSM_STATE_INITIALIZATION_CHECK_POSITIVE_HV_RELAY_STATE , I165C_FSM_STATE_INITIALIZATION_REQUEST_SELF_TEST , I165C_FSM_STATE_INITIALIZATION_SELF_TEST_WAIT_ACK , I165C_FSM_STATE_INITIALIZATION_WAIT_SELF_TEST ,
  I165C_FSM_STATE_INITIALIZATION_SET_AVERAGING_FACTOR , I165C_FSM_STATE_INITIALIZATION_AVERAGING_FACTOR_WAIT_ACK , I165C_FSM_STATE_INITIALIZATION_SET_ERROR_THRESHOLD , I165C_FSM_STATE_INITIALIZATION_ERROR_THRESHOLD_WAIT_ACK ,
  I165C_FSM_STATE_INITIALIZATION_SET_WARNING_THRESHOLD , I165C_FSM_STATE_INITIALIZATION_WARNING_THRESHOLD_WAIT_ACK , I165C_FSM_STATE_INITIALIZATION_DISABLE_MEASUREMENT , I165C_FSM_STATE_INITIALIZATION_DISABLE_MEASUREMENT_WAIT_ACK
}
 
enum  I165C_FSM_ENABLE_STATES_e {
  I165C_FSM_STATE_ENABLE_DUMMY , I165C_FSM_STATE_ENABLE_HAS_NEVER_RUN , I165C_FSM_STATE_ENABLE_REQUEST_NEGATIVE_HV_RELAY_STATE , I165C_FSM_STATE_ENABLE_CHECK_NEGATIVE_HV_RELAY_STATE ,
  I165C_FSM_STATE_ENABLE_CHECK_POSITIVE_HV_RELAY_STATE , I165C_FSM_STATE_ENABLE_START_MEASUREMENT , I165C_FSM_STATE_ENABLE_START_MEASUREMENT_WAIT_ACK
}
 
enum  I165C_FSM_RUNNING_STATES_e {
  I165C_FSM_STATE_RUNNING_DUMMY , I165C_FSM_STATE_RUNNING_HAS_NEVER_RUN , I165C_FSM_STATE_RUNNING_READ_RESISTANCE , I165C_FSM_STATE_RUNNING_READ_RESISTANCE_WAIT_ACK ,
  I165C_FSM_STATE_RUNNING_GET_MEASUREMENT
}
 
enum  I165C_FSM_DISABLE_STATES_e {
  I165C_FSM_STATE_DISABLE_DUMMY , I165C_FSM_STATE_DISABLE_HAS_NEVER_RUN , I165C_FSM_STATE_MEASUREMENT_STOPPED_WAIT_ACK , I165C_FSM_STATE_DISABLE_SET_HV_RELAY_STATE ,
  I165C_FSM_STATE_DISABLE_REQUEST_NEGATIVE_HV_RELAY_STATE , I165C_FSM_STATE_DISABLE_CHECK_NEGATIVE_HV_RELAY_STATE , I165C_FSM_STATE_DISABLE_CHECK_POSITIVE_HV_RELAY_STATE
}
 

Functions

static void I165C_SetInitializationState (I165C_INITIALIZATION_STATE_s *pImdState, I165C_FSM_INITIALIZATION_STATES_e nextState, uint16_t idleTime)
 Sets the next state the timer value of the initialization state variable. More...
 
static void I165C_SetEnableState (I165C_ENABLE_STATE_s *pImdState, I165C_FSM_ENABLE_STATES_e nextState, uint16_t idleTime)
 Sets the next state the timer value of the enable state variable. More...
 
static void I165C_SetRunningState (I165C_RUNNING_STATE_s *pImdState, I165C_FSM_RUNNING_STATES_e nextState, uint16_t idleTime)
 Sets the next state the timer value of the running state variable. More...
 
static void I165C_SetDisableState (I165C_DISABLE_STATE_s *pImdState, I165C_FSM_DISABLE_STATES_e nextState, uint16_t idleTime)
 Sets the next state the timer value of the disable state variable. More...
 
static IMD_FSM_STATES_e I165C_Initialize (void)
 
static IMD_FSM_STATES_e I165C_Enable (void)
 
static IMD_FSM_STATES_e I165C_Disable (void)
 
static IMD_FSM_STATES_e I165C_Running (DATA_BLOCK_INSULATION_MONITORING_s *pTableInsulationMonitoring)
 trigger function for the i165c driver state machine. More...
 
static void I165C_ResetCanData (CAN_BUFFER_ELEMENT_s *pCanMessage)
 Reset CAN data. More...
 
static void I165C_WriteDataWord (uint8_t dataWord, uint16_t data, CAN_BUFFER_ELEMENT_s *pCanMessage)
 Write data in data word for CAN transmission. More...
 
static void I165C_ReadDataWord (uint8_t dataWord, uint16_t *pData, CAN_BUFFER_ELEMENT_s canMessage)
 Get data in data word from CAN transmission. More...
 
static void I165C_ReadDataWordImdInfo (uint8_t dataWord, uint16_t *pData, CAN_BUFFER_ELEMENT_s canMessage)
 Get data in data word from CAN transmission, for the specific IMD_Info message. More...
 
static void I165C_ReadDataByte (uint8_t dataByte, uint8_t *pData, CAN_BUFFER_ELEMENT_s canMessage)
 Get data in data byte from CAN transmission. More...
 
static void I165C_WriteCmd (uint8_t id, uint8_t command, CAN_BUFFER_ELEMENT_s *pCanMessage)
 Compose CAN message for CAN transmission. More...
 
static bool I165C_CheckResponse (uint8_t command, CAN_BUFFER_ELEMENT_s *pCanMessage)
 Check if iso165c acknowledged reception of sent message and get corresponding data. More...
 
static bool I165C_GetImdInfo (CAN_BUFFER_ELEMENT_s *pCanMessage)
 Get IMD Info from iso165c. More...
 
static bool I165C_IsSelfTestFinished (CAN_BUFFER_ELEMENT_s canMessage)
 Check if iso165c was initialized and is running. More...
 
static bool I165C_HasSelfTestBeenExecuted (CAN_BUFFER_ELEMENT_s canMessage)
 Check if iso165c has already been performed previously. More...
 
static void I165C_SetRelayState (uint8_t relay, uint8_t relayState)
 Set state of HV relay. More...
 
static void I165C_RequestRelayState (uint8_t relay)
 Request state of HV relay. More...
 
static bool I165C_CheckRelayState (CAN_BUFFER_ELEMENT_s canMessage, uint8_t relay, uint8_t relayState)
 Check state of HV relay. More...
 
static void I165C_SetMeasurementMode (uint8_t mode)
 Set measurement mode. More...
 
static bool I165C_CheckMeasurementMode (CAN_BUFFER_ELEMENT_s canMessage, uint8_t mode)
 Check measurement mode. More...
 
static void I165C_SetAveragingFactor (uint8_t averagingFactor)
 Set average factor of the insulation resistance averaging algorithm. More...
 
static bool I165C_CheckAcknowledgeArrived (uint8_t command, uint8_t *pTries, CAN_BUFFER_ELEMENT_s *pCanMessage)
 Check if iso165c acknowledged reception of command. More...
 
IMD_FSM_STATES_e IMD_ProcessInitializationState (void)
 Processes the initialization state. More...
 
IMD_FSM_STATES_e IMD_ProcessEnableState (void)
 Processes the IMD enable state. More...
 
IMD_FSM_STATES_e IMD_ProcessRunningState (DATA_BLOCK_INSULATION_MONITORING_s *pTableInsulationMonitoring)
 Processes the running state. More...
 
IMD_FSM_STATES_e IMD_ProcessShutdownState (void)
 Processes the shutdown state. More...
 
void TEST_I165C_ResetCanData (CAN_BUFFER_ELEMENT_s *canMessage)
 
void TEST_I165C_WriteDataWord (uint8_t dataWord, uint16_t data, CAN_BUFFER_ELEMENT_s *canMessage)
 
void TEST_I165C_ReadDataWord (uint8_t dataWord, uint16_t *data, CAN_BUFFER_ELEMENT_s canMessage)
 
void TEST_I165C_ReadDataWordImdInfo (uint8_t dataWord, uint16_t *data, CAN_BUFFER_ELEMENT_s canMessage)
 
void TEST_I165C_ReadDataByte (uint8_t dataByte, uint8_t *data, CAN_BUFFER_ELEMENT_s canMessage)
 
void TEST_I165C_WriteCmd (uint8_t id, uint8_t command, CAN_BUFFER_ELEMENT_s *canMessage)
 
bool TEST_I165C_CheckResponse (uint8_t command, CAN_BUFFER_ELEMENT_s *canMessage)
 
bool TEST_I165C_GetImdInfo (CAN_BUFFER_ELEMENT_s *canMessage)
 
bool TEST_I165C_IsSelfTestFinished (CAN_BUFFER_ELEMENT_s canMessage)
 
bool TEST_I165C_CheckAcknowledgeArrived (uint8_t command, uint8_t *tries, CAN_BUFFER_ELEMENT_s *canMessage)
 

Variables

static I165C_INITIALIZATION_STATE_s i165c_initializationState
 
static I165C_ENABLE_STATE_s i165c_enableState
 
static I165C_RUNNING_STATE_s i165c_runningState
 
static I165C_DISABLE_STATE_s i165c_disableState
 
static CAN_BUFFER_ELEMENT_s i165c_canTxMessage = {0u}
 
static CAN_BUFFER_ELEMENT_s i165c_canRxMessage = {0u}
 

Detailed Description

Driver for the insulation monitoring.

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
2019-04-07 (date of creation)
Updated
2023-02-03 (date of last update)
Version
v1.5.0
Prefix
I165C

main file of bender iso165C and iso165C-1 driver

Definition in file bender_iso165c.c.

Macro Definition Documentation

◆ I165C_FSM_SHORT_TIME

#define I165C_FSM_SHORT_TIME   (1u)

state machine short time definition in trigger calls until next state is processed

Definition at line 74 of file bender_iso165c.c.

Enumeration Type Documentation

◆ I165C_FSM_DISABLE_STATES_e

States of the disable state machine

Enumerator
I165C_FSM_STATE_DISABLE_DUMMY 

dummy state - always the first state

I165C_FSM_STATE_DISABLE_HAS_NEVER_RUN 

never run state - always the second state - unlock device

I165C_FSM_STATE_MEASUREMENT_STOPPED_WAIT_ACK 

wait for acknowledge of stop measurement request

I165C_FSM_STATE_DISABLE_SET_HV_RELAY_STATE 

request state of HV relays

I165C_FSM_STATE_DISABLE_REQUEST_NEGATIVE_HV_RELAY_STATE 

request state of negative

I165C_FSM_STATE_DISABLE_CHECK_NEGATIVE_HV_RELAY_STATE 

check negative HV relay state

I165C_FSM_STATE_DISABLE_CHECK_POSITIVE_HV_RELAY_STATE 

check positive HV relay state

Definition at line 123 of file bender_iso165c.c.

◆ I165C_FSM_ENABLE_STATES_e

States of the enable state machine

Enumerator
I165C_FSM_STATE_ENABLE_DUMMY 

dummy state - always the first state

I165C_FSM_STATE_ENABLE_HAS_NEVER_RUN 

never run state - always the second state - unlock device

I165C_FSM_STATE_ENABLE_REQUEST_NEGATIVE_HV_RELAY_STATE 

check negative HV relay state

I165C_FSM_STATE_ENABLE_CHECK_NEGATIVE_HV_RELAY_STATE 

check negative HV relay state

I165C_FSM_STATE_ENABLE_CHECK_POSITIVE_HV_RELAY_STATE 

check positive HV relay state

I165C_FSM_STATE_ENABLE_START_MEASUREMENT 

start insulation measurement

I165C_FSM_STATE_ENABLE_START_MEASUREMENT_WAIT_ACK 

check for acknowledge of start measurement request

Definition at line 103 of file bender_iso165c.c.

◆ I165C_FSM_INITIALIZATION_STATES_e

States of the initialization state machine

Enumerator
I165C_FSM_STATE_INITIALIZATION_DUMMY 

dummy state - always the first state

I165C_FSM_STATE_INITIALIZATION_HAS_NEVER_RUN 

never run state - always the second state - unlock device

I165C_FSM_STATE_INITIALIZATION_UNLOCK_WAIT_ACK 

wait acknowledge of unlocking

I165C_FSM_STATE_INITIALIZATION_CHECK_MEASUREMENT_STATE 

check if measurement is enabled. if not enable it

I165C_FSM_STATE_INITIALIZATION_ENABLE_MEASUREMENT_WAIT_ACK 

wait for acknowledge for enabling of measurement

I165C_FSM_STATE_INITIALIZATION_REQUEST_HV_RELAY_OPENING 

request HV relay state: open

I165C_FSM_STATE_INITIALIZATION_REQUEST_NEGATIVE_HV_RELAY_STATE 

check HV relay state

I165C_FSM_STATE_INITIALIZATION_CHECK_NEGATIVE_HV_RELAY_STATE 

check negative HV relay state

I165C_FSM_STATE_INITIALIZATION_CHECK_POSITIVE_HV_RELAY_STATE 

check positive HV relay state

I165C_FSM_STATE_INITIALIZATION_REQUEST_SELF_TEST 

request self-test

I165C_FSM_STATE_INITIALIZATION_SELF_TEST_WAIT_ACK 

wait acknowledge of self-test

I165C_FSM_STATE_INITIALIZATION_WAIT_SELF_TEST 

wait until self-test is finished

I165C_FSM_STATE_INITIALIZATION_SET_AVERAGING_FACTOR 

set averaging factor

I165C_FSM_STATE_INITIALIZATION_AVERAGING_FACTOR_WAIT_ACK 

wait acknowledge of averaging factor

I165C_FSM_STATE_INITIALIZATION_SET_ERROR_THRESHOLD 

configuration of error threshold

I165C_FSM_STATE_INITIALIZATION_ERROR_THRESHOLD_WAIT_ACK 

wait acknowledge of error threshold

I165C_FSM_STATE_INITIALIZATION_SET_WARNING_THRESHOLD 

configuration of warning threshold

I165C_FSM_STATE_INITIALIZATION_WARNING_THRESHOLD_WAIT_ACK 

wait acknowledge of warning threshold

I165C_FSM_STATE_INITIALIZATION_DISABLE_MEASUREMENT 

disable measurement

I165C_FSM_STATE_INITIALIZATION_DISABLE_MEASUREMENT_WAIT_ACK 

wait acknowledge of disable measurement

Definition at line 79 of file bender_iso165c.c.

◆ I165C_FSM_RUNNING_STATES_e

States of the running state machine

Enumerator
I165C_FSM_STATE_RUNNING_DUMMY 

dummy state - always the first state

I165C_FSM_STATE_RUNNING_HAS_NEVER_RUN 

never run state - always the second state

I165C_FSM_STATE_RUNNING_READ_RESISTANCE 
I165C_FSM_STATE_RUNNING_READ_RESISTANCE_WAIT_ACK 
I165C_FSM_STATE_RUNNING_GET_MEASUREMENT 

Definition at line 114 of file bender_iso165c.c.

Function Documentation

◆ I165C_CheckAcknowledgeArrived()

static bool I165C_CheckAcknowledgeArrived ( uint8_t  command,
uint8_t *  pTries,
CAN_BUFFER_ELEMENT_s pCanMessage 
)
static

Check if iso165c acknowledged reception of command.

Parameters
commandcommand to be acknowledged
[out]pTriespointer to variable counting the number of tries for reception
[in]pCanMessagepointer to CAN data sent by the iso165c
Returns
true if Acknowledge has been received, otherwise false

Definition at line 790 of file bender_iso165c.c.

Here is the call graph for this function:

◆ I165C_CheckMeasurementMode()

static bool I165C_CheckMeasurementMode ( CAN_BUFFER_ELEMENT_s  canMessage,
uint8_t  mode 
)
static

Check measurement mode.

Parameters
[in]canMessageIMD_Info to be checked, sent by the iso165c
[in]modeIMD measurement mode (activated or deactivated)
Returns
true, if measurement mode matches, otherwise false

Definition at line 758 of file bender_iso165c.c.

Here is the call graph for this function:

◆ I165C_CheckRelayState()

static bool I165C_CheckRelayState ( CAN_BUFFER_ELEMENT_s  canMessage,
uint8_t  relay,
uint8_t  relayState 
)
static

Check state of HV relay.

Parameters
[in]canMessageIMD_Info to be checked, sent by the iso165c
[in]relaypositive or negative relay
[in]relayStaterelay opened or closed
Returns
true if state matches, otherwise false

Definition at line 725 of file bender_iso165c.c.

Here is the call graph for this function:

◆ I165C_CheckResponse()

static bool I165C_CheckResponse ( uint8_t  command,
CAN_BUFFER_ELEMENT_s pCanMessage 
)
static

Check if iso165c acknowledged reception of sent message and get corresponding data.

Gets data from the CAN module through a queue.

Parameters
commandcheck if this command is sent by iso165c to acknowledge reception
[in]pCanMessagepointer to CAN data sent by the iso165c
Returns
true if transmission acknowledged, false otherwise

Definition at line 591 of file bender_iso165c.c.

Here is the call graph for this function:

◆ I165C_Disable()

static IMD_FSM_STATES_e I165C_Disable ( void  )
static

Disable state machine

Definition at line 1373 of file bender_iso165c.c.

Here is the call graph for this function:

◆ I165C_Enable()

static IMD_FSM_STATES_e I165C_Enable ( void  )
static

Enable state machine

Definition at line 1126 of file bender_iso165c.c.

Here is the call graph for this function:

◆ I165C_GetImdInfo()

static bool I165C_GetImdInfo ( CAN_BUFFER_ELEMENT_s pCanMessage)
static

Get IMD Info from iso165c.

Gets data from the CAN module through a queue.

Parameters
[in]pCanMessagepointer to CAN data sent by the iso165c
Returns
true if IMD_Info message was received, false otherwise

Definition at line 616 of file bender_iso165c.c.

Here is the call graph for this function:

◆ I165C_HasSelfTestBeenExecuted()

static bool I165C_HasSelfTestBeenExecuted ( CAN_BUFFER_ELEMENT_s  canMessage)
static

Check if iso165c has already been performed previously.

Check is made using the CAN IMD_Info data sent by the iso165c.

  • self-test executed
    Parameters
    [in]canMessageIMD_Info to be checked, sent by the iso165c
    Returns
    true if self-test has already been executed, false otherwise

Definition at line 679 of file bender_iso165c.c.

Here is the call graph for this function:

◆ I165C_Initialize()

static IMD_FSM_STATES_e I165C_Initialize ( void  )
static

Initialization state machine

Definition at line 805 of file bender_iso165c.c.

Here is the call graph for this function:

◆ I165C_IsSelfTestFinished()

static bool I165C_IsSelfTestFinished ( CAN_BUFFER_ELEMENT_s  canMessage)
static

Check if iso165c was initialized and is running.

Check is made using the CAN IMD_Info data sent by the iso165c.

  • the IMC is up and running with no errors:
  • insulation measurement deactivated
  • self-test executed
    Parameters
    [in]canMessageIMD_Info to be checked, sent by the iso165c
    Returns
    true if IMD_Info was received, false otherwise

Definition at line 640 of file bender_iso165c.c.

Here is the call graph for this function:

◆ I165C_ReadDataByte()

static void I165C_ReadDataByte ( uint8_t  dataByte,
uint8_t *  pData,
CAN_BUFFER_ELEMENT_s  canMessage 
)
static

Get data in data byte from CAN transmission.

Parameters
dataBytedata byte ("position") in CAN structure to be read from (see data sheet page 15)
[out]pDatapointer where to put read data from data byte
canMessageCAN structure used for transmission

Definition at line 560 of file bender_iso165c.c.

◆ I165C_ReadDataWord()

static void I165C_ReadDataWord ( uint8_t  dataWord,
uint16_t *  pData,
CAN_BUFFER_ELEMENT_s  canMessage 
)
static

Get data in data word from CAN transmission.

Parameters
dataWorddata word ("position") in CAN structure to be read from (see data sheet page 15)
[out]pDatapointer where to put read data from data word
canMessageCAN structure used for transmission

Definition at line 526 of file bender_iso165c.c.

◆ I165C_ReadDataWordImdInfo()

static void I165C_ReadDataWordImdInfo ( uint8_t  dataWord,
uint16_t *  pData,
CAN_BUFFER_ELEMENT_s  canMessage 
)
static

Get data in data word from CAN transmission, for the specific IMD_Info message.

Parameters
dataWorddata word ("position") in CAN structure to be read from (see data sheet page 15)
[out]pDatapointer where to put read data from data word
canMessageCAN structure used for transmission

Definition at line 543 of file bender_iso165c.c.

◆ I165C_RequestRelayState()

static void I165C_RequestRelayState ( uint8_t  relay)
static

Request state of HV relay.

Parameters
[in]relaypositive or negative relay

Definition at line 714 of file bender_iso165c.c.

Here is the call graph for this function:

◆ I165C_ResetCanData()

static void I165C_ResetCanData ( CAN_BUFFER_ELEMENT_s pCanMessage)
static

Reset CAN data.

Used before starting a new transmission.

Parameters
[in,out]pCanMessagepointer to CAN data to be reset

Definition at line 506 of file bender_iso165c.c.

◆ I165C_Running()

static IMD_FSM_STATES_e I165C_Running ( DATA_BLOCK_INSULATION_MONITORING_s pTableInsulationMonitoring)
static

trigger function for the i165c driver state machine.

This function contains the sequence of events in the i165c state machine. It must be called time-triggered, every 100ms.

Parameters
pTableInsulationMonitoringpointer to insulation database entry

Definition at line 1229 of file bender_iso165c.c.

Here is the call graph for this function:

◆ I165C_SetAveragingFactor()

static void I165C_SetAveragingFactor ( uint8_t  averagingFactor)
static

Set average factor of the insulation resistance averaging algorithm.

Parameters
[in]averagingFactorset IMD averaging factor

Definition at line 776 of file bender_iso165c.c.

Here is the call graph for this function:

◆ I165C_SetDisableState()

static void I165C_SetDisableState ( I165C_DISABLE_STATE_s pImdState,
I165C_FSM_DISABLE_STATES_e  nextState,
uint16_t  idleTime 
)
static

Sets the next state the timer value of the disable state variable.

Parameters
[in,out]pImdStatestate of the enable state machine
[in]nextStatestate to be transferred into
[in]idleTimewait time for the state machine

Definition at line 489 of file bender_iso165c.c.

◆ I165C_SetEnableState()

static void I165C_SetEnableState ( I165C_ENABLE_STATE_s pImdState,
I165C_FSM_ENABLE_STATES_e  nextState,
uint16_t  idleTime 
)
static

Sets the next state the timer value of the enable state variable.

Parameters
[in,out]pImdStatestate of the enable state machine
[in]nextStatestate to be transferred into
[in]idleTimewait time for the state machine

Definition at line 455 of file bender_iso165c.c.

◆ I165C_SetInitializationState()

static void I165C_SetInitializationState ( I165C_INITIALIZATION_STATE_s pImdState,
I165C_FSM_INITIALIZATION_STATES_e  nextState,
uint16_t  idleTime 
)
static

Sets the next state the timer value of the initialization state variable.

Parameters
[in,out]pImdStatestate of the initialization state machine
[in]nextStatestate to be transferred into
[in]idleTimewait time for the state machine

Definition at line 438 of file bender_iso165c.c.

◆ I165C_SetMeasurementMode()

static void I165C_SetMeasurementMode ( uint8_t  mode)
static

Set measurement mode.

Parameters
[in]modeset IMD measurement mode

Definition at line 747 of file bender_iso165c.c.

Here is the call graph for this function:

◆ I165C_SetRelayState()

static void I165C_SetRelayState ( uint8_t  relay,
uint8_t  relayState 
)
static

Set state of HV relay.

Parameters
[in]relayset state of positive or negative relay
[in]relayStateopen or close relay

Definition at line 701 of file bender_iso165c.c.

Here is the call graph for this function:

◆ I165C_SetRunningState()

static void I165C_SetRunningState ( I165C_RUNNING_STATE_s pImdState,
I165C_FSM_RUNNING_STATES_e  nextState,
uint16_t  idleTime 
)
static

Sets the next state the timer value of the running state variable.

Parameters
[in,out]pImdStatestate of the enable state machine
[in]nextStatestate to be transferred into
[in]idleTimewait time for the state machine

Definition at line 472 of file bender_iso165c.c.

◆ I165C_WriteCmd()

static void I165C_WriteCmd ( uint8_t  id,
uint8_t  command,
CAN_BUFFER_ELEMENT_s pCanMessage 
)
static

Compose CAN message for CAN transmission.

Write CMD byte.

Parameters
idCAN ID to use
commandcommand to be used (see data page 15 section 6.3 and further)
[out]pCanMessagepointer to CAN structure to be used for transmission

Definition at line 582 of file bender_iso165c.c.

◆ I165C_WriteDataWord()

static void I165C_WriteDataWord ( uint8_t  dataWord,
uint16_t  data,
CAN_BUFFER_ELEMENT_s pCanMessage 
)
static

Write data in data word for CAN transmission.

Parameters
dataWorddata word ("position") in CAN structure to be written to (see data sheet page 15)
datadata to be written in data word
[in]pCanMessageCAN structure to be used for transmission

Definition at line 513 of file bender_iso165c.c.

◆ IMD_ProcessEnableState()

IMD_FSM_STATES_e IMD_ProcessEnableState ( void  )

Processes the IMD enable state.

This function needs to be implemented in the dedicated driver. This function enables the actual IMD device to start the insulation measurement. Functionality need to be fullfilled after one call.

Returns
IMD_FSM_STATE_RUNNING if startup has been completed. Returns IMD_FSM_STATE_ERROR if an error is detected that prohibits a working IMD driver.

Definition at line 1482 of file bender_iso165c.c.

Here is the call graph for this function:

◆ IMD_ProcessInitializationState()

IMD_FSM_STATES_e IMD_ProcessInitializationState ( void  )

Processes the initialization state.

This function needs to be implemented in the dedicated driver. This function initializes the required SW modules and peripherals but does not start the actual IMD measurement.

Returns
IMD_FSM_STATE_INITIALIZATION if initialization not fininished and another call is required. IMD_FSM_STATE_IMD_ENABLE if initialization is finished and IMD_FSM_STATE_ERROR if an error is detected that prohibits a working IMD driver.

Definition at line 1478 of file bender_iso165c.c.

Here is the call graph for this function:

◆ IMD_ProcessRunningState()

IMD_FSM_STATES_e IMD_ProcessRunningState ( DATA_BLOCK_INSULATION_MONITORING_s pTableInsulationMonitoring)

Processes the running state.

This function needs to be implemented in the dedicated driver

Parameters
pTableInsulationMonitoringpointer to insulation monitoring database entry
Returns
IMD_FSM_STATE_RUNNING if measurement works as expected, otherwise IMD_FSM_STATE_ERROR if an error is detected that prohibits a further execution of the IMD driver.

Definition at line 1486 of file bender_iso165c.c.

Here is the call graph for this function:

◆ IMD_ProcessShutdownState()

IMD_FSM_STATES_e IMD_ProcessShutdownState ( void  )

Processes the shutdown state.

This function needs to be implemented in the dedicated driver. This function disables the actual IMD device to stop the insulation measurement.

Returns
IMD_FSM_STATE_SHUTDOWN if shutdown state is not fininished and another call is required. IMD_FSM_STATE_IMD_ENABLE if shut down has been completed and IMD_FSM_STATE_ERROR if an error is detected that prohibits a working IMD driver.

Definition at line 1491 of file bender_iso165c.c.

Here is the call graph for this function:

◆ TEST_I165C_CheckAcknowledgeArrived()

bool TEST_I165C_CheckAcknowledgeArrived ( uint8_t  command,
uint8_t *  tries,
CAN_BUFFER_ELEMENT_s canMessage 
)

Definition at line 1524 of file bender_iso165c.c.

Here is the call graph for this function:

◆ TEST_I165C_CheckResponse()

bool TEST_I165C_CheckResponse ( uint8_t  command,
CAN_BUFFER_ELEMENT_s canMessage 
)

Definition at line 1515 of file bender_iso165c.c.

Here is the call graph for this function:

◆ TEST_I165C_GetImdInfo()

bool TEST_I165C_GetImdInfo ( CAN_BUFFER_ELEMENT_s canMessage)

Definition at line 1518 of file bender_iso165c.c.

Here is the call graph for this function:

◆ TEST_I165C_IsSelfTestFinished()

bool TEST_I165C_IsSelfTestFinished ( CAN_BUFFER_ELEMENT_s  canMessage)

Definition at line 1521 of file bender_iso165c.c.

Here is the call graph for this function:

◆ TEST_I165C_ReadDataByte()

void TEST_I165C_ReadDataByte ( uint8_t  dataByte,
uint8_t *  data,
CAN_BUFFER_ELEMENT_s  canMessage 
)

Definition at line 1509 of file bender_iso165c.c.

Here is the call graph for this function:

◆ TEST_I165C_ReadDataWord()

void TEST_I165C_ReadDataWord ( uint8_t  dataWord,
uint16_t *  data,
CAN_BUFFER_ELEMENT_s  canMessage 
)

Definition at line 1503 of file bender_iso165c.c.

Here is the call graph for this function:

◆ TEST_I165C_ReadDataWordImdInfo()

void TEST_I165C_ReadDataWordImdInfo ( uint8_t  dataWord,
uint16_t *  data,
CAN_BUFFER_ELEMENT_s  canMessage 
)

Definition at line 1506 of file bender_iso165c.c.

Here is the call graph for this function:

◆ TEST_I165C_ResetCanData()

void TEST_I165C_ResetCanData ( CAN_BUFFER_ELEMENT_s canMessage)

Definition at line 1497 of file bender_iso165c.c.

Here is the call graph for this function:

◆ TEST_I165C_WriteCmd()

void TEST_I165C_WriteCmd ( uint8_t  id,
uint8_t  command,
CAN_BUFFER_ELEMENT_s canMessage 
)

Definition at line 1512 of file bender_iso165c.c.

Here is the call graph for this function:

◆ TEST_I165C_WriteDataWord()

void TEST_I165C_WriteDataWord ( uint8_t  dataWord,
uint16_t  data,
CAN_BUFFER_ELEMENT_s canMessage 
)

Definition at line 1500 of file bender_iso165c.c.

Here is the call graph for this function:

Variable Documentation

◆ i165c_canRxMessage

CAN_BUFFER_ELEMENT_s i165c_canRxMessage = {0u}
static

Definition at line 222 of file bender_iso165c.c.

◆ i165c_canTxMessage

CAN_BUFFER_ELEMENT_s i165c_canTxMessage = {0u}
static

Definition at line 221 of file bender_iso165c.c.

◆ i165c_disableState

I165C_DISABLE_STATE_s i165c_disableState
static
Initial value:
= {
.timer = 0u,
.triggerEntry = 0u,
.receptionTries = 0u,
.receptionTriesMessage = 0u,
}
@ I165C_FSM_STATE_DISABLE_HAS_NEVER_RUN
@ I165C_FSM_STATE_DISABLE_DUMMY

Definition at line 212 of file bender_iso165c.c.

◆ i165c_enableState

I165C_ENABLE_STATE_s i165c_enableState
static
Initial value:
= {
.timer = 0u,
.triggerEntry = 0u,
.previousState = I165C_FSM_STATE_ENABLE_DUMMY,
.receptionTries = 0u,
.receptionTriesMessage = 0u,
}
@ I165C_FSM_STATE_ENABLE_HAS_NEVER_RUN
@ I165C_FSM_STATE_ENABLE_DUMMY

Definition at line 194 of file bender_iso165c.c.

◆ i165c_initializationState

I165C_INITIALIZATION_STATE_s i165c_initializationState
static
Initial value:
= {
.timer = 0u,
.triggerEntry = 0u,
.receptionTries = 0u,
.receptionTriesMessage = 0u,
.negativeRelayClosed = true,
.positiveRelayClosed = true,
}
@ I165C_FSM_STATE_INITIALIZATION_DUMMY
@ I165C_FSM_STATE_INITIALIZATION_HAS_NEVER_RUN

Definition at line 176 of file bender_iso165c.c.

◆ i165c_runningState

I165C_RUNNING_STATE_s i165c_runningState
static
Initial value:
= {
.timer = 0u,
.triggerEntry = 0u,
.receptionTries = 0u,
.receptionTriesMessage = 0u,
}
@ I165C_FSM_STATE_RUNNING_HAS_NEVER_RUN
@ I165C_FSM_STATE_RUNNING_DUMMY

Definition at line 203 of file bender_iso165c.c.