This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM13E23019: Sequencer disabling behaviour

Part Number: AM13E23019

AM13e2x TRM (Rev.A) has very limited information about the behaviour of resetting the SEQENABLE flag.

We would like to understand how the sequencer behaves when SEQENABLE flag is reset while conversion is ongoing:

  • Does the ongoing sequence finish/pause/abort?
  • If the sequence is not aborted immediately, what happens with the DMA trigger?
  • How does it affect neighboring sequencers?

Background: In our use case, we want to call a "stop" routine at any time and after that, do not receive any new measurements from this sequence, even if HW triggers are happening. Afterwards, the "start" routine may be called to receive the fresh measurements.

Currently, the stop routine looks like:

  • DL_ADC_disableSequencer
  • DL_ADC_disableDMAInterrupt
  • Disable DMA channel

And start routine:

  • Reset and enable DMA channel to accept new sequence (addresses and size)
  • DL_ADC_clearDMAInterruptStatus
  • DL_ADC_enableDMAInterrupt
  • DL_ADC_enableSequencer

These procedures are working as expected and were able to stop and restart the sequence during our tests. However, we are still interested in the more detailed information about the behaviour of SEQENABLE flag to analyse how robust routines are for corner cases under specific timings

  • Hi Oleksandr,

    Thank you for the detailed question and for sharing your stop/start routines. 

    The AM13E230x TRM (Rev. A) does not explicitly document what happens when SEQENABLE is cleared mid-conversion.

    The key insight comes from how the sequencer handles pre-emption. Even in the most aggressive pre-emption mode, the hardware is explicitly designed to **never abort a single SOC conversion that is already in progress**. The specification states:

    "The ongoing sequence will be discarded **after completing any ongoing conversion** and arbitration will switch to higher priority sequence."

    This pattern is consistent across all pre-emption modes documented in the architecture. The hardware waits for the current SOC conversion to reach EOC before acting on any state change. This means that when SEQENABLE is cleared mid-conversion, the most likely behavior is:

    - The **currently active single SOC conversion will complete** and its result will be stored
    - **No new SOC conversions will be initiated** after that point for this sequencer
    - **New external triggers arriving after SEQENABLE is cleared will not be accepted** by the disabled sequencer

    This corresponds to a scenario from a mid-conversion perspective — the in-flight conversion completes, then the sequencer stops — rather than an immediate hard abort.


    DMA Trigger Implication

    This is an important corner case for your implementation. The ADCWRAPPER architecture generates DMA interrupts at End of Conversion (EOC):

    "ADCWRAPPER generates a DMA interrupt after end of conversion (EOC) of previous conversion only."

    This means that **after calling `DL_ADC_disableSequencer`, one residual DMA trigger may still fire** corresponding to the EOC of the conversion that was already in progress. Your current stop routine correctly handles this because you immediately follow the sequencer disable with `DL_ADC_disableDMAInterrupt` and then disable the DMA channel entirely — providing three independent layers of protection against any stale data transfer.


    Impact on Neighboring Sequencers

    Based on the sequencer arbitration architecture, disabling one sequencer should have **no disruptive effect on neighboring sequencers**. The arbiter simply removes the disabled sequencer from consideration in the priority chain:

    - SEQ1 → SEQ2 → SEQ3 → SEQ4 priority ordering is maintained among **enabled** sequencers only
    - A disabled sequencer does not block, pre-empt, or interfere with the conversion flow of other active sequencers
    - The overflow flag logic is per-sequencer, so disabling one sequencer does not affect the overflow status of others

    The one interaction worth being aware of: if your disabled sequencer was **currently being serviced by the arbiter** at the moment of disable, the arbiter will complete that sequencer's current SOC and then move to the next enabled sequencer in priority order on the following arbitration cycle.


    Assessment of Your Stop/Start Routines

    Your routines are well-structured. Here is a detailed assessment/breakdown:

    Stop Routine:

    Step Purpose Assessment
    `DL_ADC_disableSequencer` Prevents new triggers from starting new sequences Correct first step — blocks new work immediately 
    `DL_ADC_disableDMAInterrupt` Blocks residual DMA trigger from in-flight EOC Critical step — catches the one likely residual trigger
     Disable DMA channel  Prevents any stale data transfer  Belt-and-suspenders protection

    Start Routine:

    Step Purpose Assessment
    Reset and enable DMA channel Fresh addressing and transfer size Correct — ensures no stale DMA state
    `DL_ADC_clearDMAInterruptStatus` Clears any pending interrupt from residual EOC Important ordering — must clear before re-enablin
     `DL_ADC_enableDMAInterrupt` Re-arms DMA triggering Correct
    `DL_ADC_enableSequencer` Re-enables trigger acceptance Correct last step — sequencer only re-armed after DMA is fully ready

    The ordering in your start routine is particularly important. Clearing the DMA interrupt status **before** re-enabling the interrupt and sequencer ensures that any residual EOC event from the stopped sequence does not immediately trigger a spurious DMA transfer of stale data.


    Optional Enhancement for Maximum Robustness

    If you want to completely eliminate any timing uncertainty around the residual in-flight conversion, you could add a **status poll** between the sequencer disable and DMA interrupt disable steps in your stop routine:

    DL_ADC_disableSequencer(...);
    
    // Optional: poll until sequencer is no longer actively converting
    // Check busy/active status flag if available on AM13e2x
    while (DL_ADC_isSequencerActive(...)) { } // confirm in-flight SOC has completed
    
    DL_ADC_disableDMAInterrupt(...);
    DL_ADC_disableDMAChannel(...);

    Best Regards,

    Zackary Fleenor

  • Hello Zackary!
    Thank you very much for the detailed breakdown. This helps us a lot!

    BR,
    Oleksandr