There is no problem with the configuration of the actual timer part. Using the interrupt to flash the LED is successful, but the PA6 pin remains low and no PWM wave is generated.
I still haven't found the problem, but I switched to the CH1 channel of TIMER1 and used the PA1 output to change the above TIMER15 to TIMER1, CH0 to CH1, and PA6 to PA1, and the output can be normal. It is initially thought that there is something wrong with the TIMER1 timer. Some TIMER15 timer functions cannot be configured, or TIMER15 itself has bugs
void pwm_pin_config(void) { rcu_periph_clock_enable(RCU_GPIOA); gpio_af_set(GPIOA, GPIO_AF_2, GPIO_PIN_1); gpio_mode_set(GPIOA, GPIO_MODE_AF, GPIO_PUPD_NONE, GPIO_PIN_1); gp io_output_options_set( GPIOA, GPIO_OTYPE_PP, GPIO_OSPEED_50MHZ, GPIO_PIN_1); } /*! \ brief Configure TIMER peripherals \ param [in] none \ param [out] none \ retval none */ void pwm_timer_config(void) { timer_parameter_struct timer_initpara; timer_oc_parameter_struct pwm_initpara; pwm_pin_config(); rcu_periph_clock_enable(RCU_TIMER1); timer_deinit(TIMER1); .prescaler = 1800-1; timer_initpara.alignedmode = TIMER_COUNTER_EDGE; timer_initpara.counterdirection = TIMER_COUNTER_UP; timer_initpara.period = 1200-1; timer_initpara.clockdivision = TIMER_CKDIV_DIV1; timer_initpara.repetitioncounter = 0; timer_init(TIMER1,&timer_in itpara); /* TIMERf1 channel Control update interrupt enable*/ // timer_interrupt_enable(TIMER1,TIMER_INT_UP); // nvic_irq_enable(TIMER1_IRQn,0,1); /* Step 2: Compare mode configuration: Set the CHxCOMSEN bit to configure the output comparison shadow register; Set the CHxCOMCTL bit to Configure the output mode (set high/set low/invert); set the CHxP/CHxNP bits to select the polarity of the active level; set CHxEN to enable the output. */ pwm_initpara.outputstate = TIMER_CCX_ENABLE; pwm_initpara.ocpolarity = TIMER_OC_POLARITY_HIGH; //pwm_initpara.ocidlestate = TIMER_OC_IDLE_STATE_LOW; timer_channel_output_config(TIMER1, TIMER_CH_1, &pwm_initpara); timer_channel_output_mode_config(TIMER1, TIME R_CH_1, TIMER_OC_MODE_PWM1); timer_channel_output_shadow_config(TIMER1, TIMER_CH_1, TIMER_OC_SHADOW_ENABLE); / * Step 4: Configure the output comparison time base through the TIMERx_CAR register and TIMERx_CHxCV register: CHxVAL can be changed at runtime according to the waveform you expect*/ timer_channel_output_pulse_value_config(TIMER1, TIMER_CH_1, 1000); /* TIMER1 counter enable*/ timer_enable( TIMER1); }