ADC slef Test

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

ADC slef Test

856 Views
Ayaz
Contributor IV

Project Overview

I’m working on a design where ADC sampling is triggered through an eMIOS → BCTU → ADC chain. The BCTU receives triggers from eMIOS PWM channels configured in OPWMT mode to create precise timing offsets between trigger events.


Current Setup

  • ADC0 processes two groups of signals:
    • Group 1 (two ADC channels) triggered by eMIOS_0_CH1
    • Group 2 (two ADC channels) triggered by eMIOS_0_CH2
  • Each signal sample takes about 1.3 µs, so each group requires approximately 2.6 µs.
  • The second group (triggered by CH2) is offset by 3.6 µs (+1 µs margin) to avoid overlap with the first group.

Timing sequence:

Time (µs):    0          1.3        2.6        3.6        4.9        6.2        7.2
              |----------|----------|----------|----------|----------|----------|----------|

eMIOS_0_CH1   ---> adc_ch1 (start at 0 µs)
              ---> adc_ch2 (after 1.3 µs)

eMIOS_0_CH2   (offset by 3.6 µs)
              ---> adc_ch1 (start at 3.6 µs)
              ---> adc_ch2 (after 1.3 µs → ~4.9 µs)

eMIOS_0_CH4   (offset by 7.2 µs)
              ---> software trigger for ADC0 self-test
  • After both groups complete, I added eMIOS_0_CH4 as a software trigger (via callback) to start an ADC self-test on ADC0.using the Adc_Sar_Ip_SelfTest API
  • CH4 is offset by 7.2 µs to ensure all sampling is complete before the self-test begins.

Observation

When I toggle a GPIO in the CH4 callback, it fires as expected. However, running the ADC self-test for a single ADC instance takes about 13 µs (measured in software).

Skærmbillede 2025-09-11 173539.png


Question

  • Is this self-test duration (~13 µs) expected for S32K3xx ADC (Algorithm S + C)?
  • My calculations:
    • Sampling Phase Time (ST) = 23
    • Evaluation Time per bit = 4
    • Data Processing Time (DP) = 2
      Ayaz_1-1757609074765.png

       

  • What is the best way to schedule the self-test without impacting the 25 µs acquisition cycle? Are there alternative or more efficient methods to trigger self-tests for ADCs, considering that each instance may contain multiple ADC channel groups? I'm currently using the Adc_Sar_Ip_SelfTest API from the RTD, and I would like to know whether it's more appropriate to perform the self-test during initialization, at runtime, or both. What are the best practices for handling ADC self-tests in terms of timing, reliability, and overall system performance?
  • Would masking only ADC0 triggers (instead of freezing all BCTU triggers) be the right approach to keep ADC1 and ADC2 running during the self-test?

Goal: Ensure periodic self-test on ADC0 without disturbing the real-time sampling of other ADCs.
 I have attached my project so you can have a look.
s32k344
RTD_6.0.0

Tags (1)
0 Kudos
Reply
1 Reply

763 Views
_Leo_
NXP TechSupport
NXP TechSupport

Thank you for your interest in our products and for contributing to our community.

According with 60.3.17.2 Self-test section: Individual steps can take up to 1 µs at 80 MHz ADC clock frequency.

Please find attached example. In practice, I cannot get less than 14us per instance.

For safety applications, it is important to verify correct operation at regular intervals. But also consider that the ADC Self-Test function should be called at any time after driver was initialized and there are no ongoing conversions.

_Leo__0-1758237227307.png

When you suspend debug session, in Expressions tab you can observe results: g_fifo1Result, which corresponds to the BCTU list measurements, meanwhile g_fifo1Volts corresponds to the conversion in volts.

_Leo__1-1758237302648.png

We hope this resolves your issue.

For more questions, please help me creating a new post.

0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-2167985%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EADC%20slef%20Test%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2167985%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CH3%20id%3D%22toc-hId-1974811799%22%20id%3D%22toc-hId-1999686227%22%3E%3CSTRONG%3EProject%20Overview%3C%2FSTRONG%3E%3C%2FH3%3E%3CP%3EI%E2%80%99m%20working%20on%20a%20design%20where%20ADC%20sampling%20is%20triggered%20through%20an%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EeMIOS%20%E2%86%92%20BCTU%20%E2%86%92%20ADC%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Echain.%20The%20BCTU%20receives%20triggers%20from%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EeMIOS%20PWM%20channels%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Econfigured%20in%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EOPWMT%20mode%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eto%20create%20precise%20timing%20offsets%20between%20trigger%20events.%3C%2FP%3E%3CHR%20%2F%3E%3CH3%20id%3D%22toc-hId-167357336%22%20id%3D%22toc-hId-192231764%22%3E%3CSTRONG%3ECurrent%20Setup%3C%2FSTRONG%3E%3C%2FH3%3E%3CUL%3E%3CLI%3E%3CSTRONG%3EADC0%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eprocesses%20two%20groups%20of%20signals%3A%3CUL%3E%3CLI%3E%3CSTRONG%3EGroup%201%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E(two%20ADC%20channels)%20triggered%20by%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EeMIOS_0_CH1%3C%2FSTRONG%3E%3C%2FLI%3E%3CLI%3E%3CSTRONG%3EGroup%202%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E(two%20ADC%20channels)%20triggered%20by%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EeMIOS_0_CH2%3C%2FSTRONG%3E%3C%2FLI%3E%3C%2FUL%3E%3C%2FLI%3E%3CLI%3EEach%20signal%20sample%20takes%20about%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3E1.3%E2%80%AF%C2%B5s%3C%2FSTRONG%3E%2C%20so%20each%20group%20requires%20approximately%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3E2.6%E2%80%AF%C2%B5s%3C%2FSTRONG%3E.%3C%2FLI%3E%3CLI%3EThe%20second%20group%20(triggered%20by%20CH2)%20is%20offset%20by%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3E3.6%E2%80%AF%C2%B5s%20(%2B1%E2%80%AF%C2%B5s%20margin)%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eto%20avoid%20overlap%20with%20the%20first%20group.%3C%2FLI%3E%3C%2FUL%3E%3CP%3E%3CSTRONG%3ETiming%20sequence%3A%3C%2FSTRONG%3E%3C%2FP%3E%3CPRE%3ETime%20(%C2%B5s)%3A%20%20%20%200%20%20%20%20%20%20%20%20%20%201.3%20%20%20%20%20%20%20%202.6%20%20%20%20%20%20%20%203.6%20%20%20%20%20%20%20%204.9%20%20%20%20%20%20%20%206.2%20%20%20%20%20%20%20%207.2%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7C----------%7C----------%7C----------%7C----------%7C----------%7C----------%7C----------%7C%0A%0AeMIOS_0_CH1%20%20%20---%26gt%3B%20adc_ch1%20(start%20at%200%20%C2%B5s)%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20---%26gt%3B%20adc_ch2%20(after%201.3%20%C2%B5s)%0A%0AeMIOS_0_CH2%20%20%20(offset%20by%203.6%20%C2%B5s)%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20---%26gt%3B%20adc_ch1%20(start%20at%203.6%20%C2%B5s)%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20---%26gt%3B%20adc_ch2%20(after%201.3%20%C2%B5s%20%E2%86%92%20~4.9%20%C2%B5s)%0A%0AeMIOS_0_CH4%20%20%20(offset%20by%207.2%20%C2%B5s)%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20---%26gt%3B%20software%20trigger%20for%20ADC0%20self-test%3C%2FPRE%3E%3CUL%3E%3CLI%3EAfter%20both%20groups%20complete%2C%20I%20added%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EeMIOS_0_CH4%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eas%20a%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3Esoftware%20trigger%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E(via%20callback)%20to%20start%20an%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EADC%20self-test%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eon%20ADC0.using%20the%26nbsp%3BAdc_Sar_Ip_SelfTest%26nbsp%3BAPI%3C%2FLI%3E%3CLI%3ECH4%20is%20offset%20by%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3E7.2%E2%80%AF%C2%B5s%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eto%20ensure%20all%20sampling%20is%20complete%20before%20the%20self-test%20begins.%3C%2FLI%3E%3C%2FUL%3E%3CHR%20%2F%3E%3CH3%20id%3D%22toc-hId--1640097127%22%20id%3D%22toc-hId--1615222699%22%3E%3CSTRONG%3EObservation%3C%2FSTRONG%3E%3C%2FH3%3E%3CP%3EWhen%20I%20toggle%20a%20GPIO%20in%20the%20CH4%20callback%2C%20it%20fires%20as%20expected.%20However%2C%20running%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EADC%20self-test%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Efor%20a%20single%20ADC%20instance%20takes%20about%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3E13%E2%80%AF%C2%B5s%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E(measured%20in%20software).%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Sk%C3%A6rmbillede%202025-09-11%20173539.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Sk%C3%A6rmbillede%202025-09-11%20173539.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F356541i693EEEED278EC4E0%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Sk%C3%A6rmbillede%202025-09-11%20173539.png%22%20alt%3D%22Sk%C3%A6rmbillede%202025-09-11%20173539.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%E2%80%83%3C%2FP%3E%3CHR%20%2F%3E%3CH3%20id%3D%22toc-hId-847415706%22%20id%3D%22toc-hId-872290134%22%3E%3CSTRONG%3EQuestion%3C%2FSTRONG%3E%3C%2FH3%3E%3CUL%3E%3CLI%3EIs%20this%20self-test%20duration%20(~13%E2%80%AF%C2%B5s)%20expected%20for%20S32K3xx%20ADC%20(Algorithm%20S%20%2B%20C)%3F%3C%2FLI%3E%3CLI%3EMy%20calculations%3A%3CUL%3E%3CLI%3ESampling%20Phase%20Time%20(ST)%20%3D%2023%3C%2FLI%3E%3CLI%3EEvaluation%20Time%20per%20bit%20%3D%204%3C%2FLI%3E%3CLI%3EData%20Processing%20Time%20(DP)%20%3D%202%3CBR%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Ayaz_1-1757609074765.png%22%20style%3D%22width%3A%20565px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Ayaz_1-1757609074765.png%22%20style%3D%22width%3A%20565px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F356538iBC58C5EB5EA04E32%2Fimage-dimensions%2F565x126%3Fv%3Dv2%22%20width%3D%22565%22%20height%3D%22126%22%20role%3D%22button%22%20title%3D%22Ayaz_1-1757609074765.png%22%20alt%3D%22Ayaz_1-1757609074765.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3CBR%20%2F%3E%3C%2FLI%3E%3C%2FUL%3E%3C%2FLI%3E%3CLI%3EWhat%20is%20the%20best%20way%20to%20schedule%20the%20self-test%20without%20impacting%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3E25%E2%80%AF%C2%B5s%20acquisition%20cycle%3C%2FSTRONG%3E%3F%20Are%20there%20alternative%20or%20more%20efficient%20methods%20to%20trigger%20self-tests%20for%20ADCs%2C%20considering%20that%20each%20instance%20may%20contain%20multiple%20ADC%20channel%20groups%3F%20I'm%20currently%20using%20the%26nbsp%3BAdc_Sar_Ip_SelfTest%26nbsp%3BAPI%20from%20the%20RTD%2C%20and%20I%20would%20like%20to%20know%20whether%20it's%20more%20appropriate%20to%20perform%20the%20self-test%20during%20initialization%2C%20at%20runtime%2C%20or%20both.%20What%20are%20the%20best%20practices%20for%20handling%20ADC%20self-tests%20in%20terms%20of%20timing%2C%20reliability%2C%20and%20overall%20system%20performance%3F%3C%2FLI%3E%3CLI%3EWould%20masking%20only%20ADC0%20triggers%20(instead%20of%20freezing%20all%20BCTU%20triggers)%20be%20the%20right%20approach%20to%20keep%20ADC1%20and%20ADC2%20running%20during%20the%20self-test%3F%3C%2FLI%3E%3C%2FUL%3E%3CP%3E%3CSTRONG%3EGoal%3A%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3EEnsure%20periodic%20self-test%20on%20ADC0%20without%20disturbing%20the%20real-time%20sampling%20of%20other%20ADCs.%3CBR%20%2F%3E%26nbsp%3BI%20have%20attached%20my%20project%20so%20you%20can%20have%20a%20look.%3CBR%20%2F%3Es32k344%3CBR%20%2F%3ERTD_6.0.0%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2172326%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20ADC%20slef%20Test%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2172326%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EThank%20you%20for%20your%20interest%20in%20our%20products%20and%20for%20contributing%20to%20our%20community.%3C%2FP%3E%0A%3CP%3EAccording%20with%20%3CEM%3E60.3.17.2%20Self-test%3C%2FEM%3E%20section%3A%20%3CEM%3EIndividual%20steps%20can%20take%20up%20to%201%20%C2%B5s%20at%2080%20MHz%20ADC%20clock%20frequency.%3C%2FEM%3E%3C%2FP%3E%0A%3CP%3EPlease%20find%20attached%20example.%20In%20practice%2C%20I%20cannot%20get%20less%20than%2014us%20per%20instance.%3C%2FP%3E%0A%3CP%3EFor%20safety%20applications%2C%20it%20is%20important%20to%20verify%20correct%20operation%20at%20regular%20intervals.%20But%20also%20consider%20that%20the%20ADC%20Self-Test%20function%20should%20be%20called%20at%20any%20time%20after%20driver%20was%20initialized%20and%20there%20are%20no%20ongoing%20conversions.%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22_Leo__0-1758237227307.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22_Leo__0-1758237227307.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F357614iE0C49172958BDFD8%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22_Leo__0-1758237227307.png%22%20alt%3D%22_Leo__0-1758237227307.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EWhen%20you%20suspend%20debug%20session%2C%20in%20%3CEM%3EExpressions%3C%2FEM%3E%20tab%20you%20can%20observe%20results%3A%20%3CEM%3Eg_fifo1Result%3C%2FEM%3E%2C%20which%20corresponds%20to%20the%20BCTU%20list%20measurements%2C%20meanwhile%20%3CEM%3Eg_fifo1Volts%3C%2FEM%3E%20corresponds%20to%20the%20conversion%20in%20volts.%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22_Leo__1-1758237302648.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22_Leo__1-1758237302648.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F357615i1182A6528F989166%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22_Leo__1-1758237302648.png%22%20alt%3D%22_Leo__1-1758237302648.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EWe%20hope%20this%20resolves%20your%20issue.%3C%2FP%3E%0A%3CP%3EFor%20more%20questions%2C%20please%20help%20me%20creating%20a%20%3CSTRONG%3Enew%20post%3C%2FSTRONG%3E.%3C%2FP%3E%3C%2FLINGO-BODY%3E