cancel
Showing results for 
Search instead for 
Did you mean: 

How to determine from which channel the capture took place?

Siragh ASUTP
Associate II
Posted on May 01, 2017 at 08:06

Hello. I use stm32a4 and timer2 (channel 3 and channel 4) in capture mode. How to determine from which channel the capture took place?

4 REPLIES 4
Posted on May 01, 2017 at 18:11

Check the TIMx->SR it flags which channel(s) captured.

Use the TIMx->SR = ~CLEARTHISBIT; // not the &= RMW form

void TIM2_IRQHandler(void)

{

if(TIM_GetITStatus(TIM2, TIM_IT_CC3) == SET)

{

TIM_ClearITPendingBit(TIM2, TIM_IT_CC3);

Cap3 = TIM_GetCapture3(TIM2);

}

if(TIM_GetITStatus(TIM2, TIM_IT_CC4) == SET)

{

TIM_ClearITPendingBit(TIM2, TIM_IT_CC4);

Cap4 = TIM_GetCapture4(TIM2);

}

}

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on May 01, 2017 at 18:12

Duplicate Thread

https://community.st.com/0D50X00009XkdeMSAR

 
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Siragh ASUTP
Associate II
Posted on May 16, 2017 at 06:22

Thanks for the answer. I use the HAL library. Can you give an example for this library?

Posted on May 16, 2017 at 18:46

No

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..