cancel
Showing results for 
Search instead for 
Did you mean: 

Capture compare interrupt STM32F7 TIM3

SBrid
Associate II

Hello there.

I have an encoder connected to timer 3 (TIM3) and I'd like to set this timer to generate an interrupt when a certain amount of ticks have been reached (1658 ticks). I'd like to program the timer's counter to 1658 ticks and let the encoder count up to this value and generate an interrupt. I'm using the STM32F7 using the CubeMX generator.

Could somebody please point me in the right direction in how I could achieve this please?

3 REPLIES 3
S.Ma
Principal

If you need to count say 1658 falling edges and the timer is only used for this, then connect the source to channel 1, 2 or ETR pin, and use the signal a timer counter clock which will increment until reaching the value you want. Say the overflow value (update event) will kick an interrupt event.

SBrid
Associate II

There isn't a method of the timer counting the ticks and then generating a single interrupt once 1658 falling edges have been detected. I had it in my head I could set the CCR register to 1658 and once this has been reached, generate a interrupt.

Bob S
Principal

Yes, you can do that. The CCRx and ARRx registers behave just like any other timer mode to generate update or compare interrupts.