AnsweredAssumed Answered

Program flow for synchronous data acquisition from SDADC and ADC using DMA

Question asked by imtiaz.usama on Mar 29, 2016
Latest reply on Mar 29, 2016 by nielsen.kristian
Hi,
I was wondering if someone could give me advice about my program flow for reading SDADCs and ADCs simultaneously. I'm not sure posting my code here would help so much as I'm not facing a bug exactly but rather stuck on how to proceed type.

Essentially I have a PCB with an STM32F373CC, with 8 signal conditioned channels connected to SDADCs. 
5 Channels connected to SDADC1 and 3 to SDADC3. 
SDADC3 is triggered with Injected Synchro conversion with SDADC1
Where SDADC1 is triggered with Timer T3_CC1 which is set to my sampling frequency which is usually somewhere between 500Hz to 1000Hz. 
I intend to do some signal processing soon, so I'd like to avoid using the processor as much as possible. Right now, I'm using DMA2_CH3 to get SDADC_JDATA13R register and write the data by ping pong buffering. Of course, this passing of buffers happens in the DMA interrupt triggered on HT and TC flags.

My main program is just a loop that checks when one of the buffers is filled and then packages that data into an ethernet packet and transmits it. 

On my PCB are also two other signal inputs coming into ADC PA2 and PA6. I'd like to capture them with the same sampling rate as that of SDADCs. So I'm trying to trigger it by T3_TRGO and do the data transfer by DMA1_CH1, intending ping ponging here too.

What I'm not sure about is, I don't think the DMAs can be triggered together or linked somehow. So maybe I need to check the buffers for both SDADC and ADC, and package the data and transmit when data from both is available. I'm afraid that maybe it takes too much time that might cause some issues. e.g. if I check SDADC and ADC buffer conditions individually, it might take so long processing a peripheral that the other buffer gets overwritten by the time its turn comes. If instead I wait for both conditions to become true, that might delay the overall processing. 

I'm wondering if there is a better way to do it.

Thanks

Outcomes