2023-06-09 07:49 AM
In my case I configured my counter as center aligned mode and my PWM mode as PWM mode 1.
Finally I used the CCR(compare capture register) but i don't have no idea how this CCR work that means it sends a PWM signal every period of time or point by point.
Thank you for your answer.
Solved! Go to Solution.
2023-06-12 02:45 AM
PWM is typically sent in a block-by-block. You configure the timer module with the desired parameters, such as the PWM frequency, duty cycle, and the hardware takes care of generating the PWM waveform based on these settings.
Foued
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2023-06-09 08:14 AM
Hello @Hajer GAMMOUDI ,
In PWM mode, the frequency determined by the value of the TIMx_ARR register and TIMx_CCRx
The signal can be generated with a duty cycle determined by the register value. The value set in the CCR decides the width of the pulse.
Assign a value of 0-65535 to this register directly to determine the duty cycle. Duty cycle calculation method:
the value of TIMx_CCRx divided by the value of the ARR register is the duty cycle because the duty cycle is between 0 and 100%, the value of the TIMx_CCRx register generally cannot exceed the value of the ARR register, otherwise it may cause PWM The accuracy of the frequency or duty cycle.
Read the TIM chapter in RM for more details.
Foued
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2023-06-09 11:47 PM
As @Hajer GAMMOUDI says he is new to the ST world, it might be helpful to point out that RM in @KHALSI_Foued ‘s reply refers to the Reference Manual. Each group of Stm32 microcontrollers has its own Reference Manual and they describe in detail how every ST peripheral works right down to which bit in which register needs to be set for each function.
I’ll admit that the Reference Manual is not an easy read at times, but that’s only because it is complete and the peripherals being described are very powerful and flexible.
There is also the Programming Manual which describes the Arm processor and those peripherals designed by the Arm company. But that’s not relevant for timers.
2023-06-12 12:37 AM
Thank you @KHALSI_Foued, but my question was if the PWM signal is sent every period of time or point by point, that means is it generated by blocks or point by point.
2023-06-12 02:45 AM
PWM is typically sent in a block-by-block. You configure the timer module with the desired parameters, such as the PWM frequency, duty cycle, and the hardware takes care of generating the PWM waveform based on these settings.
Foued
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2023-06-12 02:47 AM
Thank you very much!
2023-06-12 02:51 AM
If this solves your problem, please mark my answer as "Best Answer" by clicking on the "Select as Best" button, this can be helpful for Community users to find this solution faster.
Foued
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.