ModusToolbox Safety Test Library
Loading...
Searching...
No Matches
CSV Clock Supervisor

General Description

Functional self-test for the CLK_HF CSV (Clock Supervisor) comparators.

The CSV hardware monitors a target CLK_HF against a reference clock and raises a SRSS fault (CY_SYSFAULT_SRSS_CSV) when the target frequency falls outside a configured supervision window.

The self-test verifies end-to-end CSV functionality by temporarily programming an impossible supervision window (period=1 monitored cycle, lower=199, upper=201 reference cycles). Any CLK_HF frequency other than about refFreq/200 violates it: a running clock arrives before the lower limit and a stopped clock misses the upper limit, forcing an immediate CY_SYSFAULT_SRSS_CSV fault. The test then polls for the fault to reach SelfTest_Clock_CSV_ISR through the fault structure for up to CSV_TEST_TIMEOUT_US 1-us poll iterations.

Usage
  1. Route the fault-structure interrupt to SelfTest_Clock_CSV_ISR via Cy_SysInt_Init and enable the NVIC mux line. The fault structure itself is configured by the test.
  2. Fill an stl_clock_csv_entry_t with the target CLK_HF index, the CSV reference clock (the test writes it to SRSS_CSV_REF_SEL, which is shared by all CLK_HF CSVs), the fault-structure pointer, and the NvicMuxN_IRQn the fault interrupt is routed to.
  3. Call SelfTest_Clock_CSV. On success (OK_STATUS) the CSV comparator is left disabled; the application must re-arm CSV and restore its own fault handler before enabling operational supervision.

Macros

#define CSV_TEST_TIMEOUT_US   (100u)
 Timeout for the SelfTest_Clock_CSV.