ModusToolbox Safety Test Library
Loading...
Searching...
No Matches
HWFILT3P3Z (HW3P3Z filter STL module)

General Description

The HWFILT3P3Z (Hardware 3-Pole / 3-Zero Filter) self-test validates a single HW3P3Z filter channel by verifying its low-pass frequency response.

The channel is configured as a 2nd-order IIR low-pass filter and driven through the AHB interface with two tones: an in-band low-frequency tone that the filter passes and an out-of-band high-frequency tone that it heavily attenuates.

Stages exercised: AHB write path (DATA_IN0 trigger), the FILTER_BUSY handshake, AHB read of DATA_OUT, the forward multipliers (cx0..cx3), the feedback multipliers (cy1..cy3), the accumulator, the coefficient scale factors (scaleCX, scaleCY), the output gain (gOut), the output limits (limMax, limMin) and the frequency-selective magnitude response of the IIR section. Because the output swings negative (zero output offset), the 24-bit DATA_OUT payload is masked and sign-extended explicitly by the test.

On devices that provide CY_IP_MXS40PPSS, PPCA exposes two HWFILT3P3Z subsystem instances:

  • HWFILT3P3Z_SS0 with 4 independent filter channels (PPCA_HWFILT3P3Z_SS_0)
  • HWFILT3P3Z_SS1 with 2 independent filter channels (PPCA_HWFILT3P3Z_SS_1)

Filter Theory

The self-test exercises the full IIR signal path by applying two frequency-selective stimulus tones and verifying the LPF magnitude response. The filter under test is a 2nd-order IIR low-pass filter (3P3Z topology, 3rd pole and zero at the origin, cx3 = cy3 = 0) with a double zero at z = -1 (Nyquist) and a conjugate pole pair close to DC.

Filter Transfer Function
The Z-domain transfer function is:
K * (1 + z^-1)^2
H(z) = -----------------------
1 - b1*z^-1 + b2*z^-^2
Coefficient mapping (scaleCY = CY_SCALE_FACTOR_1, gOut = 1):
cx0 = cx2 = 0x3CD (~= 9.78 * 10^-4 in Q0.23 after scaleCX=0 shift)
cx1 = 0x79A (= 2 * cx0, double-zero structure)
cy1 = 0x007833D6 (stored value; actual b1 ~= +1.87816 after scaleCY=1 shift)
cy2 = 0xFFC78F61 (stored value; actual b2 ~= +0.88187 after scaleCY=1 shift)
Pole locations (magnitude r, angle theta):
r ~= 0.9403 (sqrt(b2))
theta ~= 0.051 rad/sample (arccos(b1 / (2r)))
Cutoff Frequency
The -3 dB normalized frequency computed from H(z) is:
wc ~= 0.0404 rad/sample
fc = wc / (2*pi) * fs ~= 0.00643 * fs
Because the filter is driven by AHB register writes rather than a fixed hardware clock, the real-world cutoff frequency scales linearly with the AHB sample rate (fs). There is no absolute Hz cutoff baked into the coefficients; all frequency information is normalized to samples. The test tones are also defined in normalized frequency, so the pass/fail criterion is independent of the actual write rate.
Test Tone Gains
omega_low = 2*pi/40 -> gain ~= -17.2 dB (in-band, passes the LPF)
omega_high = 2*pi/5 -> gain ~= -54.6 dB (out-of-band, heavily attenuated)
attenuation ratio ~= 74:1 (threshold: HWFILT3P3Z_ATT_RATIO = 8:1)
#define HWFILT3P3Z_ATT_RATIO
Required attenuation ratio for the out-of-band sub-test: low_peak must be strictly greater than HWFIL...
Definition SelfTest_HWFILT3P3Z.h:160
Compressed Sine Tables
To minimise ROM usage, neither tone is stored as a full 40-sample array:
Low-frequency (period 40): 10-entry quarter-period table.
Reconstruction: sine symmetry -- Q2 mirrors Q1, Q3/Q4 negate Q1/Q2.
Storage: 10 * 2 Bytes = 20 Bytes.
High-frequency (period 5): 5-entry fundamental-period table.
Reconstruction: periodic wrap -- sample[n] = table[n % 5].
Storage: 5 * 2 Bytes = 10 Bytes.

More Information

The test procedure for each filter channel:

 1) Save the original user configuration of the HWFILT3P3Z.
 2) Enable the subsystem peripheral, disable the channel, then
    program it in CPU accelerator mode (srcSel = AHB, enTrig0 = true)
    as a 2nd-order low-pass filter (see the coefficient set below);
    re-enable the channel.
 3) Drive the out-of-band high-frequency tone, then the in-band
    low-frequency tone, each through DATA_IN0 (which supplies the
    sample and triggers the computation); poll FILTER_BUSY until idle
    (with a defensive iteration bound) and record the peak absolute
    DATA_OUT value of each tone.
 4) Pass when the in-band peak reaches a minimum threshold and
    exceeds HWFILT3P3Z_ATT_RATIO times the out-of-band peak. If the
    ERROR_IN_HWFILT3P3Z error-injection flag is set, the status is
    flipped so that a fault-free run is reported as ERROR_STATUS.
 5) Restore the original filter configuration and return the result.

API Reference

 Macros
 
 Functions