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
  • Once the buffer is full, I'd "unzip" it into arrays per channel, then do whatever math you want, like taking the average:

    // Assuming int16_t sample_buffer[3*8] is the EasyDMA buffer for SAADC,
    
    // 3 channels with 8 samples each.
    int16_t adc_ch_buffer[3][8];
    
    // Split ADC buffer into individual channels
    for (int i = 0; i < 8; i++) {
        for(int j=0; j < 3; j++) {
            adc_ch_buffer[j][i] = (*sample_buffer)[i*3+j]);
        }
    }

Children
No Data
Related