-
gd32f30x:外部上升沿触发timer1_singlepulse模式错误
各位朋友大家好,我在使用gd32f30x的外部上升沿触发timer1_singlepulse模式时,出现timer1ch2的pwm输出不规则的问题:1.应用情况:外部触发频率:100kHz,输出pwm频率:100kHz,占空比3/20.2.波形:蓝色:外部触发源紫色:timer1ch2输出pwm3.配置代码:timer_initpara.prescaler=83;timer_initpara.alignedmode=TIMER_COUNTER_EDGE;timer_initpara.counterdirection=TIMER_COUNTER_UP;timer_initpara.period=19;timer_initpara.clockdivision=TIMER_CKDIV_DIV1;timer_initpara.repetitioncounter=0;timer_init(TIMER1,&timer_initpara);/*auto-reloadpreloaddisable*/timer_auto_reload_shadow_disable(TIMER1);/*CH2configurationinOCPWM0mode*/timer_ocinitpara.ocpolarity=TIMER_OC_POLARITY_HIGH;timer_ocinitpara.ocnpolarity=TIMER_OCN_POLARITY_HIGH;timer_ocinitpara.outputstate=TIMER_CCX_ENABLE;timer_ocinitpara.outputnstate=TIMER_CCXN_DISABLE;timer_ocinitpara.ocidlestate=TIMER_OC_IDLE_STATE_LOW;timer_ocinitpara.ocnidlestate=TIMER_OCN_IDLE_STATE_LOW;timer_channel_output_config(TIMER1,TIMER_CH_2,&timer_ocinitpara);timer_channel_output_pulse_value_config(TIMER1,TIMER_CH_2,3);timer_channel_output_mode_config(TIMER1,TIMER_CH_2,TIMER_OC_MODE_PWM0);timer_channel_output_shadow_config(TIMER1,TIMER_CH_2,TIMER_OC_SHADOW_DISABLE);timer_channel_output_fast_config(TIMER1,TIMER_CH_2,TIMER_OC_FAST_ENABLE);/*TIMER1CH0inputcaptureconfiguration*/timer_icinitpara.icpolarity=TIMER_IC_POLARITY_RISING;timer_icinitpara.icselection=TIMER_IC_SELECTION_DIRECTTI;timer_icinitpara.icprescaler=TIMER_IC_PSC_DIV1;timer_icinitpara.icfilter=0x00;timer_input_capture_config(TIMER1,TIMER_CH_0,&timer_icinitpara);/*singlepulsemodeselection*/timer_single_pulse_mode_confi
2022-03-09 7