Skip to main content
Graduate
May 29, 2025
Solved

PWM mode and ARPE bit | Confirmations

  • May 29, 2025
  • 3 replies
  • 442 views

Hi everyone,

I am dealing with the configuration of a PWM in center-aligned mode in the context of the stm32H755 MCU. Such PWM is managed using TIM1 as "driver". The application requires to change every 100 us (TIM1 period) the ARR register to make it last a little bit longer/shorter at every cycle.

I am running into the issue of updating the ARR register and noticing that while the expected output duty should be 100%, it is not. A very small peak down can be seldomly noticed on the oscilloscope.

As of today, the only solution I have implemented is the check for up-counting and downcounting of TIM1 (100 us + 100 us), updating the ARR register only in down-counting instances, avoiding the peak. But in this case the control running in the background is underperforming, actuating once every 2 hits.

I have found on the datasheet the ARPE bit, for what concerns my application I think it might help in my case but i would love to have some confirmations. Do I avoid the "peak issue" just setting this bit and updating the ARR whenever in the upcounting/downcounting phases? It will be updated at the beginning of the next phase, regardless the counting direction?

Zzaaack_0-1748528362740.png

Thanks very much for the support.

Zack

 

    This topic has been closed for replies.
    Best answer by Sarra.S

    Hello @Zzaaack

    When the ARPE bit is set, updates to the ARR register are buffered and only take effect at the next update event, so the new ARR value will be applied synchronously with the timer's counting cycle. 

    In your case, enabling ARPE will allow you to update the ARR register at any point during the counting cycle (up-counting or down-counting)

    3 replies

    Sarra.SAnswer
    ST Employee
    May 30, 2025

    Hello @Zzaaack

    When the ARPE bit is set, updates to the ARR register are buffered and only take effect at the next update event, so the new ARR value will be applied synchronously with the timer's counting cycle. 

    In your case, enabling ARPE will allow you to update the ARR register at any point during the counting cycle (up-counting or down-counting)

    ZzaaackAuthor
    Graduate
    May 30, 2025

    Hi @Sarra.S 

    Thank you very much for your prompt response!
    Let me add a side-question.

    If i have the ARPE bit set and set a new ARR value even if the update event is yet to arrive. The ARR value will not be changed before the update event is recalled.

    In case i decide to read the ARR value before it is actually actuated, do I get the buffered value or the actual value (let's call it old value)?

    ST Employee
    May 30, 2025

    Hello again @Zzaaack

    yes, if you read the ARR register while the ARPE bit is set, you will get the buffered value