Skip to main content
SBrid
Associate II
June 23, 2019
Question

Capture compare interrupt STM32F7 TIM3

  • June 23, 2019
  • 3 replies
  • 967 views

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?

This topic has been closed for replies.

3 replies

S.Ma
Principal
June 23, 2019

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
SBridAuthor
Associate II
June 23, 2019

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
Super User
June 24, 2019

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