Skip to main content
Visitor II
November 22, 2024
Question

PWM duty cycke update

  • November 22, 2024
  • 2 replies
  • 1089 views

Hey

We have consider following part# for our induction cooker application and we have few queries for PWM duty cycle update as per below

1) STM32F302 and STM32F303

2) STM32G491

Can I update frequency and duty cycle on the fly from software/code written by me, without stopping PWM module? I don't want any gap/delay when I update frequency or duty cycle.

 

If we can do, than please answer my following queries:

 

 

PWM is running and I am updating the frequency or duty cycle on the fly, now I want to clarify the following points?

 

1)when the newly updated frequency or duty cycle actually applies?

 

- At immediately when I update it?

- After the end of the current running cycle means applicable with a new cycle?

- Can you please point out the reference related to this in the datasheet or user manual?

- May I have any reference example with images?

 

My requirement is that it must be applied at the end of the current cycle(applicable with the new cycle, the current cycle must not be disturbed)

 

Thanks.

Alpesh

    This topic has been closed for replies.

    2 replies

    Graduate
    November 22, 2024

    All of this is thoroughly explained in Reference Manual, Timer chapter, Functional Description. You cannot design anything serious without reading and understanding it. So - start Reading The Fine Docs.

    Technical Moderator
    November 22, 2024

    Hello @alpesh_ST 

    1) when the newly updated frequency or duty cycle actually applies?

    depends if preload is activated:

    preload disable -> immediately, so not synchronized for all the registers.

    preload enabled -> at update event so synchronized and taken into account for next period (constraint is to write in the register before the end of the period).

    Please refer to the section functional description and PWM Mode in the reference manual for more details.

    Saket_Om_0-1732284820025.png

     

    Please refer to the example Projects/NUCLEO-G474RE/Examples_LL/TIM/TIM_PWMOutput_Init as starting point for your application.