2017-04-30 11:06 PM
Hello. I use stm32a4 and timer2 (channel 3 and channel 4) in capture mode. How to determine from which channel the capture took place?
2017-05-01 09:11 AM
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);}
}
2017-05-01 09:12 AM
Duplicate Thread
https://community.st.com/0D50X00009XkdeMSAR
2017-05-15 09:22 PM
Thanks for the answer. I use the HAL library. Can you give an example for this library?
2017-05-16 11:46 AM
No