Motor_Driver_Diagnostics_MDD

Module --

High-Level Description

This function operates as a reporting mechanism for all Gate Drive faults.

Figures

Component Diagram


Variable Data Dictionary

For details on module input / output variable, refer to the Data Dictionary for the application. Input / output variable names are listed here for reference.

Module InputsModule Outputs
VswitchClosed_Cnt_lgcFETFaultPhase_Cnt_enum
MtrDrvrInitStart_Cnt_lgcFETFaultType_Cnt_enum
MtrDrvrInitComplete_Cnt_lgc

Module Internal Variables

This section identifies the name, range and resolutions for module specific data created by this module. If there are no range restrictions on the variable, the term “FULL” is placed into the table for legal range.

Variable NameResolution

Legal Range

(min)

Legal Range

(max)

Software Segment
SVDiag_MtrDrvInitStartTime_mS_M_u32p0uint32FULLFULLMTRDRVDIAG_START_SEC_VAR_CLEARED_32
SVDiag_ResetWaitLoop_Cnt_M_lgcbooleanFALSETRUEMTRDRVDIAG_START_SEC_VAR_CLEARED_BOOLEAN
SVDiag_GateDrvFltSts_Cnt_D_b16uint16FULLFULLMTRDRVDIAG_START_SEC_VAR_CLEARED_16
SVDiag_MtrDrvInitActive_Cnt_M_lgcbooleanFALSETRUEMTRDRVDIAG_START_SEC_VAR_CLEARED_BOOLEAN
SVDiag_FETFaultType_Cnt_M_enumFETFAULTTYPE_ENUMNOFAULT , LOWER , UPPERMTRDRVDIAG_START_SEC_VAR_CLEARED_UNSPECIFIED
SVDiag_FETFaultPhase_Cnt_M_enumFETPHASETYPE_ENUMNOPHASE, PHASEA , PHASEB , PHASECMTRDRVDIAG_START_SEC_VAR_CLEARED_UNSPECIFIED
SVDiag_GateDriveFltAcc_Cnt_M_u16uint16FULLFULLMTRDRVDIAG_START_SEC_VAR_CLEARED_16
SVDiag_GenGateDriveFltAcc_Cnt_M_u16uint160200MTRDRVDIAG_START_SEC_VAR_CLEARED_16
SVDiag_MtrDrvInitComp_Cnt_M_lgcbooleanFALSETRUEMTRDRVDIAG_START_SEC_VAR_CLEARED_BOOLEAN
SVDiag_OnStateFltAcc_Cnt_M_u16uint16FULLFULLMTRDRVDIAG_START_SEC_VAR_CLEARED_16

User defined typedef definition/declaration

This section documents any user types uniquely used for the module.

Typedef NameElement NameUser Defined Type

Legal Range

(min)

Legal Range

(max)

<None>

Constant Data Dictionary

Calibration Constants

This section lists the calibrations used by the module. For details on calibration constants, refer to the Data Dictionary for the application.

Constant Name
k_GateDriveDiag_Cnt_str
k_GenGateDrvFltThrsh_Cnt_u16
k_GateDrvInitDwellTime_mS_u16p0
k_OnStateDiag_Cnt_str

Program(fixed) Constants

Embedded Constants

Local

Constant NameResolutionUnitsValue
D_PHASEALOWER_CNT_U16uint16Counts0U
D_PHASEBLOWER_CNT_U16uint16Counts1U
D_PHASECLOWER_CNT_U16uint16Counts2U
D_PHASEAUPPER_CNT_U16uint16Counts3U
D_PHASEBUPPER_CNT_U16uint16Counts4U
D_PHASECUPPER_CNT_U16uint16Counts5U
D_VREGUV_CNT_U16uint16Counts6U
D_BTSTRPAUV_CNT_U16uint16Counts7U
D_BTSTRPBUV_CNT_U16uint16Counts8U
D_BTSTRPCUV_CNT_U16uint16Counts9U
D_NUMOFGDSTATUSBITS_CNT_U16uint16Counts10U
D_STATUSALOWER_CNT_B16uint16Counts0x0001U
D_STATUSBLOWER_CNT_B16uint16Counts0x0002U
D_STATUSCLOWER_CNT_B16uint16Counts0x0004U
D_STATUSAUPPER_CNT_B16uint16Counts0x0008U
D_STATUSBUPPER_CNT_B16uint16Counts0x0010U
D_STATUSCUPPER_CNT_B16uint16Counts0x0020U
D_STATUSVREGUV_CNT_B16uint16Counts0x0040U
D_STATUSBTSTRPAUV_CNT_B16uint16Counts0x0080U
D_STATUSBTSTRPBUV_CNT_B16uint16Counts0x0100U
D_STATUSBTSTRPCUV_CNT_B16uint16Counts0x0200U
D_STATUSVDDUV_CNT_B16uint16Counts0x0400U
D_STATUSOVERTEMP_CNT_B16uint16Counts0x8000U
D_FFDATACLKTIME_US_U16P0uint16Microseconds4.0
D_GDRESETTIME_US_U16P0uint16Microseconds2.0

Global

This section lists the global constants used by the module. For details on global constants, refer to the Data Dictionary for the application.

Constant Name
<None>

Module specific Lookup Tables Constants

(This is for lookup tables (arrays) with fixed values, same name as other tables)

Constant NameResolutionValueSoftware Segment
None


Functions/Macros used by the Sub-Modules

Library Functions / Macros

The library and functions / Macros that are called by the various sub modules are identified below,

  1. FPM_InitFixedPoint_m

  2. DiagNStep_m

  3. DiagPStep_m

  4. DiagFailed_m

Data Hiding Functions

  1. Rte_Call_FetDrvReset_OP_SET

  2. Rte_Call_FetFlt1Data_OP_GET

  3. Rte_Call_FetFlt2Clk_OP_GET

  4. Rte_Call_FetFlt2Clk_OP_SET

  5. Rte_Call_IoHwAbPortConfig_SetFetFlt2ToOutput

  6. Rte_Call_NxtrDiagMgr_GetEventFailed

  7. Rte_Call_NxtrDiagMgr_SetNTCStatus

  8. Rte_Call_SystemTime_DtrmnElapsedTime_mS_u16

  9. Rte_Call_SystemTime_DtrmnElapsedTime_uS_u16

  10. Rte_Call_SystemTime_GetSystemTime_mS_u32

  11. Rte_Call_SystemTime_GetSystemTime_uS_u32

  12. SuspendAllInterrupts

  13. ResumeAllInterrupts

Global Functions/Macros Defined by this Module

<None>

Local Functions/Macros Used by this MDD only

MotorDriverInit

Function NameMotorDriverInitTypeMinMax
Arguments PassedvoidN/AN/AN/A
Return ValueMtrDrvInitComp_Cnt_T_lgcbooleanFALSETRUE

Design Rationale

On gate drive startup there is the possibility of its fault register logging fault bits related to startup. In order to clear these bits the gate drive is reset. Once called, this operation shall wait a time period defined by k_GateDrvInitDwellTime_mS_u16p0. Once elapsed, the operation will pulse the Reset line low for nominally 1 uSec. Once done this operation will return MtrDrvInitComp_Cnt_T_lgc = TRUE.

Description


ProcGateDriveFlt

Function NameProcGateDriveFltTypeMinMax
Arguments PassedGateDriveFltAccPtr_Cnt_T_u16pointer to type uint16FULLFULL
FF2Set_Cnt_T_lgcBooleanFALSETRUE
Return ValueVoidN/AN/AN/A

Design Rationale

This function processes gate drive fault.

Description

ProcBridgeFlt

Function NameProcBridgeFltTypeMinMax
Arguments PassedOnStateFltAccPtr_Cnt_T_u16pointer to type uint16FULLFULL
GenGateDriveFltAccPtr_Cnt_T_u16pointer to type uint160200
Return ValueVoidN/AN/AN/A

Design Rationale

This function processes bridge fault.

Description

ReadMtrDrvFltData

Function NameReadMtrDrvFltDataTypeMinMax
Arguments PassedStatusPtr_Cnt_T_b16pointer to type uint16FULLFULL
Return ValueFaultedPhases_Cnt_T_u16uint16FULLFULL

Design Rationale

The gate drive IC’s fault register is read serially through the fault flag lines. This is done by clocking the FetFlt2 line and reading in the data on FetFlt1 .

The clock signal will have a 500 kHz max frequency. At that clock frequency the interface circuit shall ensure a minimum positive and negative pulse width at the gate drive input of 750 nSec minimum. Data is clocked out on the gate drive on the falling edge of its clock input. This data is to be present at the DSP input for 250 nSec prior to the rising edge of the clock.

Description


ResetGateDrive

Function NameResetGateDriveTypeMinMax
Arguments PassedvoidN/AN/AN/A
Return ValuevoidN/AN/AN/A

Design Rationale

This function will pulse the Reset line low for nominally 1 uSec. This will clear the fault logging register fault bits. An exclusive area is used around this timing to prevent this function from being interrupted during the wait period, as a pulse for longer than 3.5uSec will put the gate drive chip into a sleep mode.

Description

GateDrvWaitTime

Function NameGateDrvWaitTimeTypeMinMax
Arguments PassedTimeToWait_uS_T_u16p0uint16FULLFULL
Return ValuevoidN/AN/AN/A

Design Rationale

The purpose of this function is to provide the delay times required for the bit manipulation used in this module. This function will wait the amount of time in uS of the variable passed into the function.

Description

Software Module Implementation

Runtime Environment (RTE) Initial Values

This section lists the initial values of data written by this module but controlled by the RTE. After RTE initialization, the data in this table will contain these values.

DataValue
VswitchClosed_Cnt_lgcFALSE
FETFaultPhase_Cnt_enum0
FETFaultType_Cnt_enum0
Rte_InitValue_MtrDrvrInitComplete_Cnt_lgcFALSE
Rte_InitValue_MtrDrvrInitStart_Cnt_lgcFALSE

Initialization Functions

None


Periodic Functions

Per: _Per1

Design Rationale

The Motor Driver Diagnostic Periodic Processing operation systematically deals with the motor driver diagnostics. Each failure diagnosed by the gate drive IC has to be fully qualified by the DSP before a fault is considered present. The qualification process used in this design is the typical PStep/Nstep fault accumulator method. This design uses an assumption that each of the individual faults detected by the gate drive IC rarely occurs. Therefore it is not necessary to track through individual fault accumulators for each of the fault indications provided by the gate drive. Instead the faults will be placed into two groups, gate drive faults and FET faults each with their own fault accumulator. For gate drive faults there is no need to identify the exact failure mode. For FET faults the exact FET failure mode is to be learned but is not required until the FET fault has been fully qualified by the DSP. This function will read in the gate drive fault register. Fault conditions detected by gate drive IC are communicated through two dual purpose fault flag lines, FF1 and FF2. The first purpose of the fault flag lines is to indicate a fault is present. The second purpose is to serially transfer an internal fault register indicating which fault was present.

Program Flow Start

Rte_Call_MtrDrvDiag_Per1_CP0_CheckpointReached()

Store Module Inputs to Local copies

Processing of function

Store Local copy of outputs into Module Outputs

Program Flow End

Rte_Call_MtrDrvDiag_Per1_CP1_CheckpointReached()

Per: MtrDrvDiag_Per2

Design Rationale

Configurable checkpoints were not added to this periodic since it doesn’t run in all system states and the current requirements for program flow check require the checkpoint to be called in all system states if it is to be used.

Program Flow Start

None

Store Module Inputs to Local copies

N/A

Processing

Rte_Call_FetDrvReset_OP_SET(STD_LOW)

Store Local copy of outputs into Module Outputs

Program Flow End

N/A

Per: _Trns1

Design Rationale

This function reinitializes variables on entering WARMINIT state.

Program Flow Start

None

Processing of function

Program Flow End

N/A


Fault Recovery Functions

None

Shutdown Functions

None

Interrupt Functions

None

Serial Communication Functions

None


Execution Requirements

Execution Rates for sub-modules called by the Scheduler

Function NameCalling FrequencySystem State(s) in which the function is called
MtrDrvDiag_Per12mSOPERATE, WARMINIT
MtrDrvDiag_Per22mSDISABLE, OFF
MtrDrvDiag_Trns1Triggered on state transitionOn entering WARMINIT

Execution Requirements for Serial Communication Functions

Function NameSub-Module called by (Serial Comm Function Name)
<None>


Memory Map Definition Requirements

Sub Modules (Functions)

Name of Sub ModuleSoftware Segment
MtrDrvDiag_Per1
MtrDrvDiag_Per2
MtrDrvDiag_Trns1

Local Functions

Name of Sub ModuleSoftware Segment
ProcGateDriveFltSA_MTRDRVDIAG_CODE
ProcBridgeFltSA_MTRDRVDIAG_CODE
ReadMtrDrvFltDataSA_MTRDRVDIAG_CODE
ResetGateDriveSA_MTRDRVDIAG_CODE
GateDrvWaitTimeSA_MTRDRVDIAG_CODE
MotorDriverInitSA_MTRDRVDIAG_CODE


Known Issues / Limitations With Design

  1. ReadMtrDrvFltData needs to be updated to support manual control of the NHET outputs when a faulted FET is detected.


Revision Control Log

Item #Rev #Change DescriptionDateAuthor Initials
11.0Initial MDD24-May-11BG
22.0Replaced exclusive area with suspend and resume interrupts20-June-11LWW
33Corrected Rte Call to GetEventFailed server in ProcBridgeFlt local function02-Dec-11JJW
44Added functionality for Hardware Power Up19-Sep-12OT
55UTP Update (hard-coded NTC numbers)20-Sep-12OT
66Added checkpoints and memmap software segment is updated for static variables28-Sep-12Selva
77Added Per2 per anomaly 457825-Apr-13LWW
88Updated range on GenGateDrv fault accumulator17-May-13LWW
99Fixed A4155 . Changes made to ReadMtrDrvFltData28-aug-13Selva
1010Updated module and display variables with SVDiag8-Oct-13VT
Last modified October 12, 2025: Initial commit (0347a62)