3.1.3.1 DIAG_CLK_Frequency()

diag_result_t DIAG_CLK_Frequency (uint32_t clockFrequency, uint32_t referenceFrequency, uint8_t msec, uint8_t tolerance)

For the diag_clk_frequency API to calculate and validate the frequency of the CPU clock using a reference SOSC.

Note:

Recommend a test time between 10ms - 30ms for test accuracy of +/- 1%. The accuracy may vary with system clock and the time in msec to run the test. Will not work with a reference frequency higher than 2MHz. For this test, the reference frequency is set to 32.768 kHz using a crystal connected to the SOSC pins. If the device does not have SOSC circuitry, an external reference clock of 32.768 kHz should be provided to the Timer1 Clock input point pin via T1CKIPPS.

Parameters:
in clockFrequency

- CPU system clock frequency value

in referenceFrequency

- Reference secondary oscillator frequency value

in msec

- Time in msec to run the test

in tolerance

- Limit for deviation frequency value

Returns:

DIAG_PASS - Success  

DIAG_FAIL - Failure  

DIAG_INVALID_ARG - Invalid  

DIAG_UNDEFINED - Undefined