Bulk_Cap_Precharge_MDD

Module –

High-Level Description

This module handles precharging of the bulk capacitor during initialization. It is part of a larger initialization sequence, along with motor driver diagnostics and temporal monitor.

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
OVERRIDESIGDIAGADC_Volt_f32PwrDiscClosed_Cnt_lgc
PMOSDIAGADC_Volt_f32PwrDiscATestComplete_Cnt_lgc
MotorVelocityMRFUnfiltered_MtrRadpS_f32PwrDiscBTestComplete_Cnt_lgc
Batt_Volt_f32
BattSwitched_Volt_f32
PwrDiscATestStart_Cnt_lgc
PwrDiscBTestStart_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
FirstRunComplete_Cnt_M_lgcn/aFALSETRUEBKCPPC_START_SEC_VAR_CLEARED_UNSPECIFIED
PowerRelayInitFltFailed_Cnt_M_lgcn/aFALSETRUEBKCPPC_START_SEC_VAR_CLEARED_UNSPECIFIED
PwrDiscATestComplete_Cnt_M_lgcn/aFALSETRUEBKCPPC_START_SEC_VAR_CLEARED_UNSPECIFIED
PwrDiscBTestComplete_Cnt_M_lgcn/aFALSETRUEBKCPPC_START_SEC_VAR_CLEARED_UNSPECIFIED
PwrDiscClosed_Cnt_M_lgcn/aFALSETRUEBKCPPC_START_SEC_VAR_CLEARED_UNSPECIFIED
BulkCapPrechargeState_Cnt_M_enum107BKCPPC_START_SEC_VAR_CLEARED_UNSPECIFIED
RunTimeFaultAcc_Cnt_M_u161FULLFULLBKCPPC_START_SEC_VAR_CLEARED_16
VerifyDiscOpenDiagTimer_mS_M_u321FULLFULLBKCPPC_START_SEC_VAR_CLEARED_32
WaitForSqrWaveDiagTimer_mS_M_u321FULLFULLBKCPPC_START_SEC_VAR_CLEARED_32
PrechargeDiagTimer_mS_M_u321FULLFULLBKCPPC_START_SEC_VAR_CLEARED_32
PostCloseDiagTimer_mS_M_u321FULLFULLBKCPPC_START_SEC_VAR_CLEARED_32
VerifyCloseDiagTimer_mS_M_u321FULLFULLBKCPPC_START_SEC_VAR_CLEARED_32
VdischMax_Volts_M_f32Single Precision Float021BKCPPC_START_SEC_VAR_CLEARED_32
VdischMin_Volts_M_f32Single Precision Float019BKCPPC_START_SEC_VAR_CLEARED_32
VbattStart_Volts_M_f32Single Precision Float030BKCPPC_START_SEC_VAR_CLEARED_32
VswitchStart_Volts_M_f32Single Precision Float020BKCPPC_START_SEC_VAR_CLEARED_32
MotionDetected_Cnt_D_lgcn/aFALSETRUEBKCPPC_START_SEC_VAR_CLEARED_UNSPECIFIED
DeltaV_Volts_D_f32Single Precision Float-2030BKCPPC_START_SEC_VAR_CLEARED_32
VswitchCorrected_Volts_D_f32Single Precision Float0120BKCPPC_START_SEC_VAR_CLEARED_32

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)

BulkCapPrechargeSequenceType

BULKCAP_WAITFORSTARTA = 0

BULKCAP_VERIFYDISCOPEN = 1

BULKCAP_WAITFORSQRWAVE = 2

BULKCAP_PRECHARGE = 3

BULKCAP_WAITFORSTARTB = 4

BULKCAP_POSTCLOSE = 5

BULKCAP_VERIFYCLOSE = 6

BULKCAP_RUNTIMEDIAG = 7

uint807

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_MtrMotionThresh_MtrRadpS_f32
k_MaxSwitchedVolt_Volts_f32
k_PwrDiscOpenThresh_Volts_f32
k_PMOSDIAGOpenThresh_Volts_f32
k_OVERRIDESIGDIAGOpenThresh_Volts_f32
k_VerifyPwrDiscOpenThresh_mS_u16
k_WaitForSqrWaveThresh_mS_u16
k_PwrDiscCloseThresh_Volts_f32
k_PrechargeThresh_mS_u16
k_PMOSVError_Volts_f32
k_PMOSTError_mS_u16
k_MaxDischEst_Uls_f32
k_MinDischEst_Uls_f32
k_VswitchDeltaThresh_Volts_f32
k_VerifyPwrDiscCloseThresh_mS_u16
k_ChargeMinDelta_Volts_f32
k_VbattSwitchThreshNonExt_Volt_f32
k_VbattSwitchThreshExNorm_Volt_f32
k_ChargeMinDeltaNonOp_Volt_f32
k_ChargeMinDeltaExtOp_Volt_f32
k_ChargeMinDeltaNormlOp_Volt_f32
k_ChargePumpDiag_Cnt_str

Program(fixed) Constants

Embedded Constants

All embedded constants whose values are provided in Eng units will be evaluated to the equivalent counts by using the FPM_InitFixedPoint_m() macro within the #define statement.

Local

Constant NameResolutionUnitsValue
D_VDISCHMAXFACTOR_ULS_F32Single Precision FloatUnitless1.05
D_VDISCHMINFACTOR_ULS_F32Single Precision FloatUnitless0.95
D_PWRDISCCONFIGB_CNT_U081Count2

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
STD_LOW
STD_HIGH
D_ZERO_CNT_U16
RTE_E_OK (0) - see Data Dictionary
D_PWRDISCCONFIGURATION_CNT_U08 - see Data Dictionary

Module specific Lookup Tables Constants

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. Abs_f32_m

  2. Min_m

  3. DiagPStep_m

  4. DiagNStep_m

  5. DiagFailed_m

Data Hiding Functions

  1. Rte_Call_SystemTime_GetSystemTime_mS_u32

  2. Rte_Call_SystemTime_DtrmnElapsedTime_mS_u16

  3. Rte_Call_NxtrDiagMgr_SetNTCStatus

  4. Rte_Call_Vbatt_Batt_V_f32

  5. Rte_Call_Vswitch_BattSwitched_V_f32

  6. Rte_Call_PhyCapPrecharge_OP_SET

  7. Rte_Call_PhyCapDischarge_OP_SET

Global Functions/Macros Defined by this Module

None

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
Rte_InitValue_MotorVelocityMRFUnfiltered_MtrRadpS_f320
Rte_InitValue_OVERRIDESIGDIAGADC_Volt_f320
Rte_InitValue_PMOSDIAGADC_Volt_f320
Rte_InitValue_PwrDiscATestComplete_Cnt_lgcFALSE
Rte_InitValue_PwrDiscATestStart_Cnt_lgcFALSE
Rte_InitValue_PwrDiscBTestComplete_Cnt_lgcFALSE
Rte_InitValue_PwrDiscBTestStart_Cnt_lgcFALSE
Rte_InitValue_PwrDiscClosed_Cnt_lgcFALSE

Initialization Functions

None


Periodic Functions

Per: _Per1

Design Rationale

None

Program Flow Start

Rte_Call_BkCpPc_Per1_CP0_CheckpointReached()

Store Module Inputs to Local copies

MotorVelocityMRFUnfiltered_MtrRadpS_T_f32 = Rte_IRead_BkCpPc_Per1_MotorVelocityMRFUnfiltered_MtrRadpS_f32()

OVERRIDESIGDIAGADC_Volt_T_f32 = Rte_IRead_BkCpPc_Per1_OVERRIDESIGDIAGADC_Volt_f32()

PMOSDIAGADC_Volt_T_f32 = Rte_IRead_BkCpPc_Per1_PMOSDIAGADC_Volt_f32()

PwrDiscATestStart_Cnt_T_lgc = Rte_IRead_BkCpPc_Per1_PwrDiscATestStart_Cnt_lgc()

PwrDiscBTestStart_Cnt_T_lgc = Rte_IRead_BkCpPc_Per1_PwrDiscBTestStart_Cnt_lgc()

Vbatt_Volts_T_f32 = Rte_IRead_BkCpPc_Per1_Batt_Volt_f32()

Vswitch_Volts_T_f32 = Rte_IRead_BkCpPc_Per1_BattSwitched_Volt_f32()

Motor Motion Check, Calculate Delta Voltage

Determine State

State – Wait for Start A

State – Verify Disconnect Open

State – Wait for Square Wave

State – Bulk Capacitor Precharge

State – Wait for Start B

State – Post Close Power Disconnect

State – Verify Power Disconnect Closed

State – Run Time Diagnostics

fbu

Store Local copy of outputs into Module Outputs

Rte_IWrite_BkCpPc_Per1_PwrDiscATestComplete_Cnt_lgc(PwrDiscATestComplete_Cnt_M_lgc)

Rte_IWrite_BkCpPc_Per1_PwrDiscBTestComplete_Cnt_lgc(PwrDiscBTestComplete_Cnt_M_lgc)

Rte_IWrite_BkCpPc_Per1_PwrDiscClosed_Cnt_lgc(PwrDiscClosed_Cnt_M_lgc)

Program Flow End

Rte_Call_BkCpPc_Per1_CP1_CheckpointReached()


Fault Recovery Functions

None

Shutdown Functions

None

Interrupt Functions

None

Serial Communication Functions

None

Server Functions

OP_SET: CapPcDcStub

Design Rationale

The digital output ports PhyCapDischarge_OP_SET and PhyCapPrecharge_OP_SET that are applicable only to Configuration B require a client/server port in Davinci Developer. However, for programs that only supports Configuration A, where these physical capacitor pins are NOT available, the Developer tool flags an error during integration of the component, since the client server ports are not connected. This server function stub will be connected to both the Client/Server ports, PhyCapDischarge_OP_SET and PhyCapPrecharge_OP_SET, to avoid the configuration error flaged by the Davinci Developer tool during integration.

Program Flow Start

N/A

Store Module Inputs to Local copies

None

Capacitor Discharge/Precharge server stub – for Configuration A

CapPcDcStub_OP_SETTypeMinMaxUTP Tol.
Arguments Passedsignal

Uint8

(IoHwAb_BoolType is a uint8)

010
Return ValueRTE_E_OKUint8000

Store Local copy of outputs into Module Outputs

None

Program Flow End

N/A

Transition Functions

Trns: _Trns1

Design Rationale

None

Program Flow Start

N/A

Store Module Inputs to Local copies

None

Set Outputs to Safe Conditions

Store Local copy of outputs into Module Outputs

None

Program Flow End

N/A

Trns: _Trns2

Design Rationale

None

Program Flow Start

N/A

Store Module Inputs to Local copies

None

Initialize Outputs

Store Local copy of outputs into Module Outputs

None

Program Flow End

N/A


Execution Requirements

Execution Rates for sub-modules called by the Scheduler

This table serves as reference for the Scheduler design

Function NameCalling FrequencySystem State(s) in which the function is called
BkCpPc_Per12 msWARMINIT, OPERATE
BkCpPc_Trns1On EventOn Entering DISABLE
BkCpPc_Trns2On EventOn Entering WARMINIT
CapPcDcStub_OP_SETN/A – stub onlyN/A – stub only

Execution Requirements for Serial Communication Functions

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


Memory Map Definition Requirements

Sub Modules (Functions)

This table identifies the software segments for functions identified in this module.

Name of Sub ModuleSoftware Segment
BkCpPc_Per1RTE_START_SEC_SA_BKCPPC_APPL_CODE
BkCpPc_Trns1RTE_START_SEC_SA_BKCPPC_APPL_CODE
BkCpPc_Trns2RTE_START_SEC_SA_BKCPPC_APPL_CODE
CapPcDcStub_OP_SETRTE_START_SEC_SA_BKCPPC_APPL_CODE

Local Functions

This table identifies the software segments for local functions identified in this module.

Name of Sub ModuleSoftware Segment
None


Known Issues / Limitations With Design

  1. INLINE functions defined in GlobalMacro.h are not unit tested.


Revision Control Log

Item #Rev #Change DescriptionDateAuthor Initials
11.0Initial Version (FDD 11B v001)13-Sep-12OT
22.0UTP Updates20-Sep-12OT
33.0Added Trns2 function to initialize startup sequence27-Sep-12OT
44.0Anomaly 3912 – write outputs in all branches24-Oct-12OT
55.0Added checkpoint statements21-Nov-12OT
66.0Updated to version 3 FDD 11B28-Feb-13Selva
77.0Set RunTimeFaultAcc_Cnt_M_u16 to zero in tans 21-Mar-13Selva
88.0Anomaly 5092 – add power disconnect configurable parameter29-May-13BDO
99.0Anomaly 5122 – updates to address integration issues04-June-13BDO
1010.0Set PwrDiscATestComplete in BULKCAP_PRECHARGE state for Configuration A05-June-13BDO
1111.0Updated to add clarification for unit testing.21-June-13BDO
Last modified October 12, 2025: Initial commit (0347a62)