3.2.15 DIAG_MCLK
The DIAG_MCLK module is designed to verify the correct functionality of the Main Clock (MCLK) through a set of C function calls.
Note: This module contains routines which sets the main clock at 48
MHz. The user would need to call DIAG_OSCCTRL_Initialize to restore the clock.
The DIAG_MCLK software test API is mapped to the following safety mechanisms:
| Function | Diagnostic Mechanism | Use Case | Elapse Time (μs)~ |
|---|---|---|---|
| DIAG_MCLK_ClockCalibration() | MCLK_CLOCK_CALIBRATION | POST | 318.39 |
| DIAG_MCLK_SFRReset() | SFR_RESET_STATE | POST | 39.54 |
| DIAG_MCLK_SFRWriteRead() | SFR_WRITE_READ | POST / OnDemand | 33.52 |
Configuring the Diagnostic
DIAG_MCLK does not require additional configuration.
Run-time Pre-requisites
DIAG_MCLK_SFRRead should be executed before DIAG_MCLK_SFRWriteRead
Using the Diagnostic
#include "definitions.h"
DIAG_TEST_STATUS DIAG_MCLK_SFRPost(void)
{
DIAG_TEST_STATUS result;
result = DIAG_MCLK_SFRReset(NULL,0,false);
if (result == DIAG_TEST_PASSED)
{
result = DIAG_MCLK_SFRWriteRead(NULL,0,false);
}
return result;
}
DIAG_TEST_STATUS DIAG_MCLK_Post(void)
{
// expected_mclk_freq should be in range of 48MHz, ex:(8000000)
// Assuming Reference is at 48MHz
return DIAG_MCLK_ClockCalibration(6000000);
}
