2018-06-06 01:03 AM
2018-06-06 01:53 AM
Reading from DMA_value must be done when new samples become available.
You must poll for the appropriate event and run your algorithm. Alternatively, transform your algorithm to run triggered by interruptions.
The event can be DMA transfer complete (because len=1) or ADC end-of-conversion.
Newer devices (407 is really old) have analog watchdog that can do a pretty good job with reduced CPU intervention.
2018-06-06 03:08 AM
'
If you know a better way to measure phase shift between 2 signals I'll gladly take all your advices!'
1. condition the input signal so you have a well defined 'phase';
2. measure the phase differential digitially. depending on your requirement, this can be done with polling, external interrupts or input capture....
2018-06-07 06:32 AM
Thank you for your answer, I put my code in a function called every time the DMA finished the conversion and it works perfectly !