cancel
Showing results for 
Search instead for 
Did you mean: 

How to implement the program for PWM generation in stm32f051c8t6tr

jm.2
Associate II

I working on stm32 microcontroller, I want to generate the pwm signal for stm32f051c8t6tr mcu.

I have assigned my prescalar as 48-1 and counter period is 1000-1 in order to generate 10KHz frequency.

My code is

TIM1->CCR1=50;

HAL_TIM_PWM_Start(&htim1,TIM_CHANNEL_1);

The above two code only i tried but i am not getting any output. Can you please me, how to solve this issue

Thanks

3 REPLIES 3
Foued_KH
ST Employee

Hello @jm.2​,

Could you please share the STM32CubeMX configuration :)

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.

Basic LED blinky works?

Check, if you have continuity from mcu to the pin where you are measuring. The simplest way is to do a "blinky" on that pin, i.e. turn the pin to GPIO output and toggle it.

Other than that, read out and check/post the TIM and relevant GPIO registers content.

Note that TIM1 is Advanced Timer thus needs to have TIM1_BDTR.MOE set.

JW

Foued_KH
ST Employee

Hello,

I recommend you this link:

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.