cancel
Showing results for 
Search instead for 
Did you mean: 

Reading phase shift between two input analog signals

Ludovic Bernard
Associate
Posted on June 06, 2018 at 10:03

 

 

The original post was too long to process during our migration. Please click on the attachment to read the original post.
3 REPLIES 3
stm322399
Senior
Posted on June 06, 2018 at 10:53

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.

henry.dick
Senior II
Posted on June 06, 2018 at 12:08

'

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....

Posted on June 07, 2018 at 13:32

Thank you for your answer, I put my code in a function called every time the DMA finished the conversion and it works perfectly !