SAADC Multiple Channel Sampling and Reset with PPI

I have a situation where I need to sample from multiple channels using SAADC on a timer (similar to maximum performance example).  However, the added catch is that at the end I want to use a timer to reset an external circuit.  I have it somewhat working but I'm currently using the RESULTDONE event to trigger the reset.  I've noticed that event gets fired multiple times, once for each channel.  The documentation is slightly vague on this point but it looks like that is expected behavior.  Is there an event I can use to tell me when ALL channels have finished?

Parents Reply Children
  • I agree that using EVENTS_END would help you achieve the desired result here. Please just remember that EVENTS_END is generated when the buffer is full, so the RESULT.MAXCNT need to be set to the appropriate value for the END event to be generated at the timing you desire.

  • Sorry, I clearly don't understand the different events.

    My understanding was that when multiple channels are being sampled, this forces the SAADC into scan mode.  In scan mode, the documentation states that END and RESULTSDONE have the same meaning.  What am I missing?

  • Could you be confusing the DONE event and the END event? They are different events.

    The Scan Mode documentation only says that the RESULTDONE and the DONE events have the same meaning when there is no oversampling.

    You can think of the event in this way: DONE is generated when a sampling is done, and RESULTDONE is generated when all samples necessary for averaging a result is done. When you don't use oversampling, averaging is done over just one sample, so DONE and RESULTDONE are generated at the same time.

    Meanwhile, END is an entirely different event and is tied to result buffer. When EasyDMA has filled the configured buffer, END is generated.

  • Ah, ok.  Thank you for the explanation.  I'll try that.

    Just to clarify, I can't do oversampling in multiple channel mode, correct?  That is to say, I can't oversample on multiple channels and average per channel.

    And to extend that a bit, what would be the best way to average multiple samples across multiple channels?

Related