Skip to main content
Graduate II
May 17, 2024
Question

TIM update Event TRGO , in centere algin mode is not working as expected

  • May 17, 2024
  • 2 replies
  • 1783 views

I'm encountering an issue with the update event triggering in STM32 TIM1. I have configured TIM1 to generate PWM signals and set the update event to Center-Aligned Mode 3. However, I've noticed that the update event occurs not only when the timer's counter reaches the auto-reload value (ARR), but also when it reaches zero. This is causing a problem because I specifically need the update event to occur only at ARR for triggering the ADC to sample.

In my project, I'm using TIM1 to generate PWM signals on channels CH1, CH1N, CH2, and CH2N. The CCR values for PWM generation are obtained from a DMA array. Additionally, I'm utilizing the update event to trigger the ADC, with ADC values being saved to a buffer via DMA.

I've tested other modes and observed that the PWM output works fine, but this issue arises only in Center-Aligned Mode 3. How can I ensure that the update event occurs only at ARR in this mode?

 

@MM..1 

@AScha.3

 

    This topic has been closed for replies.

    2 replies

    Super User
    May 18, 2024

    Don't @-invoke users in your posts to attract attention.

    Which STM32 are you using?

    > update event occurs not only when the timer's counter reaches the auto-reload value (ARR), but also when it reaches zero

    Yes, that's exactly according to documentation:

    waclawekjan_0-1716023111082.png

    > How can I ensure that the update event occurs only at ARR in this mode?

    You can't.

    Try to use Compare instead, with setting given TIMx_CCRx to the same value as ARR.

    JW

    Visitor II
    November 29, 2024

    @thannara123 

    As per the datasheet update event occurs when the timer's counter is overflow and underflow in centre align mode.

    Are you need to trigger ADC at ON time of your PWM frequency?