2010-03-14 03:01 PM
PWM capture with TIM1?
2011-05-17 06:07 AM
hi Lüfter,
sorry, I thought you were a native speaker. But no problem, here's the description of my test setup resp. my problem:
Specifically the 4 last points make me believe that TIM1 starts before the first rising edge of the PWM signal. I thought I had configured it to be triggered via a rising edge via TIM1_SMCR. Butt obviously I do something wrong... :( Attached please find a yet simplified project. The relevant lines are in ''hw_layer.c'' lines 124ff.
I very much appreciate any help on this issue. And thanks a lot in advance for your effort!Regards, Georg
PS: attached are a screenshot of the PWM signal and a simple STVD/Cosmic project2011-05-17 06:07 AM
Hi georg,
Try adding this line after while (!TIM1_SR1_CC1IF); while (!TIM1_SR1_CC2IF); // wait until capture event I think that you should wait for two events: first the CC2 event to read the duty cycle and the second one is to read the period. I hope this helps you otherwise I should run your code to find out the issue. Kep me informed. Mit besten grüssen, MCU Lüfter2011-05-17 06:07 AM
Hi georg,
Add TIM1_SR2 = 0x00; after TIM1_SR1 = 0x00; that could help ! Lüfter