Performs the ATOP AFE programmable-gain verification self-test for one ADC group, using an externally-applied differential stimulus.
The selected group's differential channel 0 is converted with the AFE off, then at 8.25x, then at 16.5x gain. The test passes when the raw (AFE-off) code is inside the caller's expected window, neither amplified code is saturated, and both amplified codes match the raw code scaled by their gain (and the 16.5x code is about twice the 8.25x code) within the caller's tolerance. The original ADC and AFE configuration is saved and restored.
- Note
- The AFE differential input has no on-chip stimulus. Before calling this function the application must apply a small, stable differential to the selected group's AFE pins (AIN0P/AIN0N, AIN4P/AIN4N, AIN6P/AIN6N or AIN8P/AIN8N), with both pins within [VSSA - 0.25 V, 1 V] and the differential small enough that the 16.5x reading stays on-scale.
-
The application is responsible for calling
Cy_PPCA_CNFG_Init() and Cy_PPCA_Enable(), and for bringing up AREF, before calling this function.
- Parameters
-
- Returns
- OK_STATUS (0) - AFE gain is within tolerance; test passed.
ERROR_STATUS (1) - Raw stimulus out of window, an amplified code saturated, or a gain out of tolerance.
MTB_STL_ERROR_TIMEOUT (10) - An ADC conversion timed out.
ERROR_BAD_PARAM (9) - NULL config or an unsupported configuration (no HW access performed).