Skip to main content
Tommino
Associate III
July 8, 2022
Solved

Timer counter does not stop when it reaches the ARR value

Hi,

I am developing a program with the nucleo STM32G474RE that passes the ARR,CCR1,CCR2 values to TIM2 after some measurements made with another general purpose timer.

However something weird occurs since when I look at TIM2 registers the ARR,CCR1,CCR2 values are correctly set but the TIM2 CNT seems to not care about the ARR value and it keeps counting.

Any idea about why this is happening?

0693W00000QKjjyQAD.png

    This topic has been closed for replies.
    waclawek.jan
    waclawek.janBest answer
    Super User
    July 8, 2022

    If you set ARR to N at the moment when CNT is already >N, CNT will count up to maximum.

    This is why there's ARR preload (TIMx_CR1.ARPE).

    JW

    3 replies

    waclawek.jan
    waclawek.janBest answer
    Super User
    July 8, 2022

    If you set ARR to N at the moment when CNT is already >N, CNT will count up to maximum.

    This is why there's ARR preload (TIMx_CR1.ARPE).

    JW

    Tommino
    TomminoAuthor
    Associate III
    July 8, 2022

    Thank jan,

    So basically the ARPE bit makes the new ARR effective synchrounously with the CNT previous overflow?

    waclawek.jan
    Super User
    July 8, 2022

    Yes.

    JW