GateDrv0Ctrl_MDD

Module Design Document

For

Gate Drive 0 Control

VERSION: 9

DATE: 12-Jan-2018

Prepared By:

Shawn Penning,

Nexteer Automotive,

Saginaw, MI, USA

Location: The official version of this document is stored in the Nexteer Configuration Management System.

Revision History

VersionDescriptionAuthorDate
1Initial versionRijvi Ahmed07-July-2016
2Updated to design revision 1.8.0Avinash James21-Jan-2017
3Updated to design revision 2.0.0Shruthi Raghavan17-Feb-2017
4Updated to design revision 2.1.0Shruthi Raghavan27-Feb-2017
5Updated to design revision 2.3.0Shruthi Raghavan14-Mar-2017
6Updated to design revision 2.4.0 – Fix for phase reasonableness issues found during integrationShruthi Raghavan24-Mar-2017
7

Removed unused inputs from OperFltMonSt function.

Added UT considerations per anomaly EA4#11845

Shruthi Raghavan26-May-2017
8Updated graphical representation for the new outputs and client call. Added details for changed & new local functions
Added new enum type and local constant
Shruthi Raghavan11-Sep-2017
9Updated design rationale for the state machine in Configuration State of gate drive. Added UT considerations per test corrections required in anomaly corrective action.Shawn Penning12-Jan-2018

Table of Contents

1 Abbrevations And Acronyms 5

2 References 6

3 GATEDRV0CTRL & High-Level Description 7

4 Design details of software module 8

4.1 Graphical representation of GATEDRV0CTRL 8

5 Variable Data Dictionary 9

5.1 User defined typedef definition/declaration 9

5.2 Variable definition for enumerated types 9

6 Constant Data Dictionary 10

6.1 Program(fixed) Constants 10

6.1.1 Embedded Constants 10

6.1.1.1 Local 10

6.1.1.2 Global 10

6.1.2 Module specific Lookup Tables Constants 10

7 Software Module Implementation 11

7.1 Sub-Module Functions 11

7.2 Initialization Functions 11

7.2.1 Per: GateDrv0CtrlInit1 11

7.3 PERIODIC FUNCTIONS 11

7.3.1 Per: GateDrv0CtrlPer1 11

7.3.1.1 Design Rationale 11

7.3.1.2 Processing of Function 11

7.3.2 Per: GateDrv0CtrlPer2 11

7.3.2.1 Design Rationale 11

7.3.2.2 Processing of Function 11

7.4 Interrupt Functions 11

7.5 Serial Communication Functions 11

7.6 Local Function/Macro Definitions 12

7.6.1 Local Function #1 12

7.6.1.1 Description 12

7.6.2 Local Function #2 12

7.6.2.1 Description 12

7.6.3 Local Function #3 12

7.6.3.1 Description 12

7.6.4 Local Function #4 12

7.6.4.1 Description 12

7.6.5 Local Function #5 12

7.6.5.1 Description 13

7.6.6 Local Function #6 13

7.6.6.1 Description 13

7.6.7 Local Function #7 13

7.6.7.1 Description 13

7.6.8 Local Function #8 13

7.6.8.1 Description 13

7.6.9 Local Function #9 13

7.6.9.1 Description 14

7.6.10 Local Function #10 14

7.6.10.1 Description 14

7.6.11 Local Function #11 14

7.6.11.1 Description 14

7.7 GLObAL Function/Macro Definitions 14

8 Known Limitations With Design 15

9 UNIT TEST CONSIDERATION 16

Abbrevations And Acronyms

AbbreviationDescription
DFDDesign functional diagram
MDDModule design Document

References

This section lists the title & version of all the documents that are referred for development of this document

Sr. No.TitleVersion
1MDD Guidelines1.02
2Software Naming Conventions1.02
3Software Coding Standards1.01
4FDD – ES311A_GateDrv0Ctrl_DesignSee synergy sub project version

GATEDRV0CTRL & High-Level Description

This module configures the GateDrive0 connected with SPI channel CSIH2. It also does the diagnostics for GateDrive0 using SPI interface.

It also performs phase reasonable diagnostics when the inverter 0 fault input is active. Detects FET fault and indicates the type of fault and also in the case of single fet fault it indicates the phase faulted as well. Phase reasonableness is disabled on a phase with shorted FET

Design details of software module

Graphical representation of GATEDRV0CTRL

Variable Data Dictionary

User defined typedef definition/declaration

Typedef NameElement NameUser Defined Type

Legal Range

(min)

Legal Range

(max)

GateDrvCfgSt-Enumeration04

Variable definition for enumerated types

Enum NameElement NameValue
GateDrvCfgStGATEDRVCFGST_RSTGATEDRVST0
GATEDRVCFGST_WAIT2MS1
GATEDRVCFGST_CFGREG2
GATEDRVCFGST_SETUPSPIREGREAD3
GATEDRVCFGST_READBACKREGS4

Constant Data Dictionary

Program(fixed) Constants

Embedded Constants

Local

Constant NameResolutionUnitsValue
GATEDRVOFFSTCHKSIZE_CNT_U081UCnt((TblSize_m(ELECGLBPRM_GATEDRVOFFSTCHKDATA_CNT_U16)/8U) - 1U)
BITMASK0_CNT_U081Cnt0x01U
BITMASK2_CNT_U081Cnt0x04U
BITMASK4_CNT_U081Cnt0x10U
MOTDRVERRMIN_NANOSEC_F32Single precision floatNanoSec0.0F
MOTDRVERRMAX_NANOSEC_F32Single precision floatNanoSec40000000.0F
DIAG2REGBOOTSTRPSPLYFLTSTRTPOS_CNT_U081Cnt5U

Global

Constant Name
Refer to the FDD

Module specific Lookup Tables Constants

Constant NameResolutionValueSoftware Segment
Refer to the design

Software Module Implementation

Sub-Module Functions

None

Initialization Functions

Per: GateDrv0CtrlInit1

PERIODIC FUNCTIONS

Per: GateDrv0CtrlPer1

Design Rationale

None

Processing of Function

See design model for details.

Per: GateDrv0CtrlPer2

Design Rationale

It is the intent of this design to hold the value of

MotDrvr0IninTestCmpl between iterations of GateDrv0CtrlPer2.

There was an inexplicable model issue in which MotDrvr0IninTestCmpl

was being reset to 0 when MotDrvr0IninTestCmpl was not being

written in the IF branch of model (refer model notes)

Implementation Considerations:

No need to use a PIM or a static variable as this signal is an RTE

output. Since RTE signals work like a static variable, the

implementation always holds the last value.

Processing of Function

See design model for details.

Interrupt Functions

None

Serial Communication Functions

None

Local Function/Macro Definitions

Local Function #1

Function NameSpiAsyncTxTypeMinMax
Arguments PassedChannel_Cnt_T_u08Spi_ChannelType0Full
TxData_Cnt_T_u16Spi_DataType0Full
Sequence_Cnt_T_u08Spi_SequenceType0Full
Return ValueNone

Description

(void) Spi_WriteIB( Channel_Cnt_T_u08, &TxData_Cnt_T_u16 );

(void) Call_Spi_AsyncTransmit( Sequence_Cnt_T_u08 );

Local Function #2

Function NameOffStVrfyStTypeMinMax
Arguments PassedNone
Return ValueNone

Description

See GateDrv0Ctrl/GateDrv0CtrlPer2/Gate Drive Enable/Gate Drive State/OffState Verification Stateblock in design model.

Local Function #3

Function NameOffStVrfyDataTypeMinMax
Arguments PassedNone
Return ValueFlt_Cnt_T_loglBooleanFALSETRUE

Description

See GateDrv0Ctrl/GateDrv0CtrlPer2/Gate Drive Enable/Gate Drive State/OffState Verification State/OffSt Verification Chk and Transition to Config State/OffStChk Incomplete/Offstate Verification /OffState Verification Check block in design model.

*It is optimized in the implementation to reduce the high static path count.

Local Function #4

Function NameCfgStTypeMinMax
Arguments PassedNone
Return ValueNone

Description

See GateDrv0Ctrl/GateDrv0CtrlPer2/Gate Drive Enable/Gate Drive State/Configuration State block in design model.

The state machine is implemented slightly differently in code vs the model, but they are functionally equivalent.
The model adds 1 to the GateDrv0CfgCnt Pim to change to the next state in Configuration,but the code assigns values from a local enumeration (see section 5.2) instead of performing arithmetic on the Pim. The enumerated state assigned to GateDrv0CfgCnt Pim will match with the resulting state in the model.

Local Function #5

Function NameReadBackRegsTypeMinMax
Arguments PassedNone
Return ValueNone

Description

See GateDrv0Ctrl/GateDrv0CtrlPer2/Gate Drive Enable/Gate Drive State/Configuration State/Read back Registers block in design model.

Local Function #6

Function NameOperFltMonrStTypeMinMax
Arguments PassedPhaOnTiMeasdA_NanoSec_T_u32Uint3204294967295
PhaOnTiMeasdB_NanoSec_T_u32Uint3204294967295
PhaOnTiMeasdC_NanoSec_T_u32Uint3204294967295
PhaOnTiSumAExp_NanoSec_T_u32Uint3204294967295
PhaOnTiSumBExp_NanoSec_T_u32Uint3204294967295
PhaOnTiSumCExp_NanoSec_T_u32Uint3204294967295
*MotDrvErrA_NanoSec_T_f32Single precision float0.0F40000000.0F
*MotDrvErrB_NanoSec_T_f32Single precision float0.0F40000000.0F
*MotDrvErrC_NanoSec_T_f32Single precision float0.0F40000000.0F
Return ValueNone

Description

See GateDrv0Ctrl/GateDrv0CtrlPer2/Gate Drive Enable/Gate Drive State/Operate Fault Monitor State block in design model.

Local Function #7

Function NameGateDrvDetermineOnStSngFETFltTypeMinMax
Arguments Passed*SpclSnpshtData0_Cnt_T_u32Uint320U4294967295U
*SpclSnpshtData1_Cnt_T_u32Uint320U4294967295U
*SpclSnpshtData2_Cnt_T_u32Uint320U4294967295U
Return ValueGenGateDrvFlt_Cnt_T_loglBooleanFALSETRUE

Description

See GateDrv0Ctrl/GateDrv0CtrlPer2/Gate Drive Enable/Gate Drive State/Operate Fault Monitor State/Determine Faults/Status Register indicates Fault/Determine OnState Single FET Fault block in design model.

Local Function #8

Function NameGateDrvDetermineVltgFltTypeMinMax
Arguments Passed*SpclSnpshtData0_Cnt_T_u32Uint320U4294967295U
*SpclSnpshtData1_Cnt_T_u32Uint320U4294967295U
*SpclSnpshtData2_Cnt_T_u32Uint320U4294967295U
Return ValueGenGateDrvFlt_Cnt_T_loglBooleanFALSETRUE

Description

See GateDrv0Ctrl/GateDrv0CtrlPer2/Gate Drive Enable/Gate Drive State/Operate Fault Monitor State/Determine Faults/Status Register indicates Fault/Determine VREG/Bootstrap Voltage Fault block in design model.

Local Function #9

Function NameGateDrvDetermineGenericFltTypeMinMax
Arguments PassedGateDrvAllSts_Cnt_T_u16Uint1600xFFFF
*SpclSnpshtData0_Cnt_T_u32Uint320U4294967295U
*SpclSnpshtData1_Cnt_T_u32Uint320U4294967295U
*SpclSnpshtData2_Cnt_T_u32Uint320U4294967295U
Return ValueGenGateDrvFlt_Cnt_T_loglBooleanFALSETRUE

Description

See GateDrv0Ctrl/GateDrv0CtrlPer2/Gate Drive Enable/Gate Drive State/Operate Fault Monitor State/Determine Faults/Status Register indicates Fault/Determine Generic Gate Drive Fault block in design model.

Local Function #10

Function NameSetNtcStInfoTypeMinMax
Arguments PassedPhaOnTiMeasd_NanoSec_T_u32Uint3204294967295
PhaOnTiSumExp_NanoSec_T_u32Uint3204294967295
AbsltErr_NanoSec_T_f32Single precision float03.4E+38
BitMask_Cnt_u08Uint80127
NtcStInfo_Uls_T_u08Uint80255
Return ValueFlt_Uls_T_lgcBooleanFalseTrue

Description

See ES311A_GateDrv0Ctrl/GateDrv0Ctrl/GateDrv0CtrlPer2/GateDrv Enable/Disable/Gate Drive Enable/Gate Drive State/Operate Fault Monitor State/Determine Faults/No Faults/GateDrvPhaReasbnChk/MeasdPhaFltChkABC block in design model. This function implements NtcStInfoPhaA, NtcStInfoPhaB and NtcStInfoPhaC common functionality.

Local Function #11

Function NameChkResVrfyRegsTypeMinMax
Arguments PassedPrmByte_Cnt_T_u08Uint8128138
Return ValueNone---

Description

Check Results of Verify GateDrive0 Registers based on calculated parameter byte and take appropriate action

Local Function #12

Function NameWriteOutputTypeMinMax
Arguments PassedNone---
Return ValueNone---

Description

Implements the ‘ES311A_GateDrv0Ctrl_new/GateDrv0Ctrl/GateDrv0CtrlPer2/Write Output’ block in simulink model.

GLObAL Function/Macro Definitions

None

Known Limitations With Design

Note: The PIM Ivtr0InactvSts is written in Per2 and used in Per1 as well as Per2. Data consistency is not an issue because of explicit scheduling requirements given in the integration manual.

Note:

  1. At multiple places, the implementation does not reset the error counter PIM when rollover to zero happens but the model does. This is because in the code the rollover is automatic (and marked intentional ), whereas in the model it isn’t that way and requires a manual reset.

  2. In all the cases where (1) is applicable, the model comments say 65535 rather than 4294967295 as the value at which reset should occur. Upon discussion with FDD owner, the comment is wrong and will be changed with the next update.

UNIT TEST CONSIDERATION

  1. Overflow is intentional and acceptable on PhaOnTiSumAExp_NanoSec_T_u32, PhaOnTiSumBExp_NanoSec_T_u32 and PhaOnTiSumCExp_NanoSec_T_u32 in Per2 function.

  2. Rollover is intentional on Rte_Pim_GateDrv0SpiTrsmErrCntr. The code has comments that also mention this consideration.
    Note: While the code and model do not exactly match on the implementation (because the model manually resets this error counter, while the code lets it auto-reset due to rollover), the output should be the same for the PIM because functionally they are same.

  3. The model is designed such that the table ELECGLBPRM_GATEDRVOFFSTCHKDATA_CNT_U16 is never indexed with a value of greater than its size in real life. However, in code we need an explicit check for safety. For this reason, when Rte_Pim_GateDrv0OffStChkIdx is given a value greater than or equal to the size of this table, the model and code will behave differently (this is expected , because it is an impossible scenario in the real world).
    ->
    For PIL testing, the consideration is that the input values given to Rte_Pim_GateDrv0OffStChkIdx when MIL vectors are not available should be less than or equal to (GATEDRVOFFSTCHKSIZE_CNT_U08).

  4. This component has a config parameter. Use the file from local/include folder and NOT the one from local/generate folder for testing so that Tessy can vary the value of the configuration parameter in the range that it is given in the data dictionary.

  5. Please rectify wrong expected values of tests as part of anomaly corrective action. See PDF attached here (refer to both root cause and corrective action).

Last modified October 12, 2025: Initial commit (af72ad2)