LoginSignup
0
0

stm32 PWM

Posted at

使用するピンはPA0
TIM2_CH1
Clock Source Internal Clock
Channel 1 PWM Generation CH1
Parameter Settings -> Counter Setting ---> Prescaler 900
L-> Counter Period 1000
Clock Configuration Input frequency 8 -> HSE -> PLLCLK -> HCLK 180MHz
-> APB1 Prescaler 1/8 --> 2x -> 45
L-> PCLK1 22.5

main(void){
    HAL_TIM_PWM_Start(&htim2, TIM_CHANNEL_1);
    while(1){
        htim2.Instance->CCR1 = 25;
		HAL_Delay(2000);
        htim2.Instance->CCR1 = 75;
		HAL_Delay(2000);
    }
}
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0