cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F103 (Blue Pill), CUBE MX and PWM

BJerk.1
Associate II

I am trying to setup a PWM output with Timer 4 by using CubeMX. When starting the code it always stops at command HAL_TIM_PWM_Start(&htim4,TIM_CHANNEL_1)

Attached are the setup in the main() and setup in the CubeMX.

Any ideas what am I missing?

0693W000000TZspQAG.png

  MX_GPIO_Init();
  MX_SPI1_Init();
  MX_TIM4_Init();
  HAL_TIM_Base_Start(&htim4); 
  HAL_TIM_PWM_Start(&htim4,TIM_CHANNEL_1);

2 REPLIES 2

What does "the code stops at command ***" mean? You single-step the code? Do you have a loop at the end of main()? Is there any output on the given pin, as observed by oscilloscope/logic analyzer?

JW

BJerk.1
Associate II

I thought the code stops at the HAL_TIM_PWM_Start, but I just didn't add any commands after that ... so that was the reason.

Sorry for that.