Skip to main content
BJerk.1
Associate II
March 10, 2020
Question

STM32F103 (Blue Pill), CUBE MX and PWM

  • March 10, 2020
  • 2 replies
  • 1879 views

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);

This topic has been closed for replies.

2 replies

waclawek.jan
Super User
March 10, 2020

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
BJerk.1Author
Associate II
March 13, 2020

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.