cancel
Showing results for 
Search instead for 
Did you mean: 

Difference between Update and Overflow interrupt

Marek Nowak_2
Associate
Posted on January 13, 2018 at 17:34

Hello, 

I would like to ask about difference between update and overflow interrupt on STM8.

For Example, on Timer2:

//F_CPU 1Mhz

//Timer2 - 16bit, max value = 65535

TIM2_TimeBaseInit(TIM2_PRESCALER_1, 999);

As I understand:

1. Overflow interrupt will occur after counting to max value of timer = 65536

2. Update interrupt will occur after counting to value 999 

Is it right?

1 REPLY 1
raimond
Associate III
Posted on January 13, 2018 at 18:37

Nope, it isn't.

STM Timers don't have an overflow at MAX. They are auto-reload counters, and they overflow at ARR always.

In your case 999. (You probably want an 1000 interval?)

Anyway, in STM terminology, an 'update' includes an 'overflow', the 'update' is more generic, but can be an overflow, among other 'update events'.

Long story short, overflow is always an update, and in case you only want overflow, they are just the same thing.

So in your specific case, you will get an interrupt at 999 and the counter will restart automatically from zero. It will not reach 65535.

You must read more carefully the timers section of the manual. STM timers are a bit different from others, but the good thing is that they are quite the same in STM8 and STM32 families.