Skip to main content
Ludovic Bernard
Associate
June 6, 2018
Question

Reading phase shift between two input analog signals

  • June 6, 2018
  • 3 replies
  • 1360 views
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.
    This topic has been closed for replies.

    3 replies

    stm322399
    Senior
    June 6, 2018
    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.

    Ludovic Bernard
    Associate
    June 7, 2018
    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 !

    henry.dick
    Associate II
    June 6, 2018
    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....