使用するピンは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);
}
}