2021-09-26 07:39 PM
Hi, I'm developing a motor project using stm32f429. But my pro can hit the HAL_TIM_IRQHandler() interrupt function but the status register is not normal when tim2 capture XORed input signal. The TI2's CC1IF is set when hit the interrupt function but after stepping one line(press F11) the SR's CC1IF has been reset. I don't know why?
2021-09-27 12:51 AM
If a channel is set to input capture, reading TIM_CCRx register clears the respective TIM_SR.CCxIF bit. The debugger is reading the TIM_CCR1 registers when the breakpoint hits, as you have the registers' view switched on.
JW
PS. The CCMR1.CC1S=0b11 value is suspicious, and so is SMCR.TS... what are you trying to accomplish, exactly?
2021-09-27 07:01 PM
Thank you @Community member , it works after switching off system viewwer. There may be no reading TIM_CCR1 register action before entering if-bracket.
I want this capture signal to trigger tim1 before, so CCMR1.CC1S=0x11b(it seems wrong now) . I want to set CC2's value to be some value to coincidence with CC1 and CC2 is pwm2 output mode. However I have some troubles when doing this, CC2's can trigger CC2IF but do not hit IRShandler() interrupt funciton. can you give some advice?
2021-09-28 01:39 AM
> I want this capture signal to trigger tim1 before
I don't quite understand what are you trying to achieve. Perhaps draw a timing diagram and post.
JW