ModusToolbox Safety Test Library
Loading...
Searching...
No Matches

General Description

Functions

uint8_t SelfTest_ATOP_ADC_Core (const stl_atop_adc_core_config_t *config)
 Performs a self-test of an ATOP ADC group by converting a known internal reference voltage and comparing the result against an expected code.

Function Documentation

◆ SelfTest_ATOP_ADC_Core()

uint8_t SelfTest_ATOP_ADC_Core ( const stl_atop_adc_core_config_t * config)

Performs a self-test of an ATOP ADC group by converting a known internal reference voltage and comparing the result against an expected code.

The SAR conversion datapath, the AUX channel multiplexer, the AFE input stage, the trigger / busy logic and the result-register read path are exercised. The original ADC and AFE configuration is preserved and restored on return so the test can be safely interleaved with normal use of the other ADC groups in the system.

The reference source, channel, expected code and tolerance are taken from config. Use ATOP_ADC_CORE_CONFIG_GRP0_VREF for the ready-made case.

Note
Only ATOP_ADC_CORE_GROUP_0 provides an on-chip reference (the 1.2 V VREF) reachable by the SAR through its AUX multiplexer, so it is the only group with a meaningful internal self-test. Any config field not supported on the current silicon (other group, non-AUX channel, unknown reference source, out-of-range expected code, zero tolerance) is rejected with ERROR_BAD_PARAM before any HW access.
The application is responsible for any system-level allocation of the ATOP ADC group to a CPU. The self-test enables the ADC and AFE through the standard PDL APIs and restores their previous enable state on return.
Parameters
configPointer to the test configuration stl_atop_adc_core_config_t.
Returns
OK_STATUS (0) - Test passed
ERROR_STATUS (1) - HW self-test failed (conversion timeout, busy stuck, or result out of tolerance)
ERROR_BAD_PARAM (9) - NULL config or an unsupported configuration (no HW access performed)