For a project I used a for loop to study a group of data converted by the ADC and stored within memory by the DMA (20 data to have a transfer completed by DMA and they are stored in a structure defined in the SRAM). So within my loop I want to convert the data stored in SRAM. With a code along those lines
With DMAtransferCompleted being a volatile int set to 1 when an interrupt for DMA transfer complete is triggered and buffer1 and buffer2 indicate where the DMA protocol wrote the data (double buffer mode).
My question is, when I put some micros() functions to check how long it takes for the loop to complete itself I get around a 1000 microseconds what is excessive for the amount of data treated even if I am dividing and multiplying data??
I don't have my whole code on me and currently typing on my phone, so I used shortcut to write the code here let me clarify:
-buffer1 is a volatile int to which I add 1 and take the modulo whenever a transfer is completed by the DMA (20 ADC conversions) it helps my code to know which buffer it can read in memory without leading to a case of writing and reading at the same time and place (double buffer mode of DMA).
Also this setup works pretty well on other codes so I don't think it is linked
Yeah, I guess it is absolutely impossible to reason with so little code available.
Buffer1[I] is a part of the structure "structure" so it is defined differently from buffer1 which is volatile int. I guess I ll come back to get more precise answers when I can reach a computer and upload the whole code.
Sorry about that.