Efficient de-interleaving without waking the CPU
I am using the STM32G474 and have the following situation:
- I have configured a Timer to run continuously at 25 kHz
- The Timer triggers the ADC to start a sequence of 6 conversions (i.e. 6 ADC channels)
- Upon completion of each ADC conversion, DMA transfers the sample to memory (repeat for the entire sequence of conversions)
- Repeat steps 2-3 until the buffer is full (ADC DMA half-conversion/full event & double buffering is used)
- This buffer now contains interleaved samples from the ADC
- Some magic de-interleaving needs to happen
- A de-interleaved buffer of ADC samples (i.e. for a single ADC channel) is passed to the FMAC (filtering) peripheral using DMA
- The output of the FMAC peripheral is transferred to memory via DMA
- Repeat steps 7-8 until the sample buffers of all 6 ADC channels have been filtered via FMAC
Ideally I want to keep the CPU asleep for this whole process; the CPU should only wake up at ~100 Hz to process the filtered data (i.e. FMAC output stored in memory) and perform other functions. However I'm unable to determine a method for de-interleaving the interleaved ADC samples from memory (step 6) without waking the CPU.
The perfect solution is if either DMA or FMAC allows me to set the 'stride length/address increment size' to 6, however this doesn't appear to be possible on the STM32G4.
Am I missing anything? What method(s) can I use to de-interleave a buffer of ADC samples from memory without CPU intervention? (or directly from ADC --> FMAC?)
Edit 2023/08/14: Reworded Step 3 for clarity, as per MasterT's comment.
Original text: "3. Upon completion of the sequence of conversions, DMA transfers the entire sequence to a buffer in memory"