cancel
Showing results for 
Search instead for 
Did you mean: 

Measure time difference between 2 PWM using STM32L4

LXian.19
Associate

Hi Guys,

I working on a project that require measure time difference between 2 PWM (Refer the picture below) . I was able to measure the PWM frequency using input capture method but not able to measure the time difference, Td between 2 PWM. Kindly need help on this. Best with example code if possible.

Thanks.

Regards,

XH Low

2 REPLIES 2

I you use firefox, pasting picture does not work, even if it appears in the editor it did. But the image *is* uploaded, so it's enough to click on the "Image" icon below and insert the newest file from there.

JW

S.Ma
Principal

get a timer which gives interrupt on input capture both rise and fall edge for both channels.

Basically, you get the timer "timestamp" for position of rising and falling edge of both channels.

You get the period, duty and time shift between them.

Properly defining the timer period is important. Timer is free running.

No prescale on input channel is allowed here.