AnsweredAssumed Answered

STM32F4 InputCaptures rising/falling on TIM3 not working like expected

Question asked by krins.florian on Jul 12, 2014
Latest reply on Jul 12, 2014 by Clive One
Hi there,

I am trying to read in an PWM-Signal on my STM32F4-Microcontroller. I know there is a PWM-Input function to get Frequency and Dutycycle, but I would like to do it "manually with Inputcaptures.

The Signal I want to read is a normal RC-Signal, 20ms long with 9 pulses. 8 pulses for signal transmitting and one final pulse filling the rest of the time with a "big" pulse (minimum 3ms long). the first 8 pulses will be 0,5ms-1,5ms high plus 0,5ms low for each.

I want to have one timer (TIM3) with Inputcapture1 for Rising, InputCapture2 for Falling-Edge detection and a Outputcompare which only counts for 3ms to detect the last "big" pulse.

My Problem is that my TIM3_IRQHandler only gets active when the rising-InputCapture creats interrupt. I don't get the mistake in my code. If I DISABLE TIM_IT_CC1(Rising) than the IRQHandler also gets active through Falling-Edge.

I am sending Text over Bluetooth to read in on PC. I am getting this:

... 
--------------------------------------------- 
 
-RISING-EVENT- sumLength: 4512 
 
-OUTPUTCOMPARE-RESET- 3ms has gone: Reset long Pulse-timer 
 
-FALLING-EVENT- PulseLength: 2999 
 
-OUTPUT-COMPARE->----------- Long Pulse captured ----------- 
 
--------------------------------------------- 
... 
 
The lined line should always appear if TIM3_IRQHandler pops up. 
So I expected something like this: 
 
... 
--------------------------------------------- 
 
-RISING-EVENT- sumLength: 4512 
 
-OUTPUTCOMPARE-RESET- 3ms has gone: Reset long Pulse-timer 
 
--------------------------------------------- 
 
-FALLING-EVENT- PulseLength: 2999 
 
--------------------------------------------- 
...

I would be so happy if anyone could help me about this.
The Code about the magic is in the attachments!!!

Befor I miss to tell: the Timer clock and GPIO clock is enabled seperatly,
if it helps I could post more parts of the code.

Greatings,
Florian

Attachments

Outcomes