问答

汇集网友智慧,解决技术难题

fz的Kevin

TA的家园币:10  

  • GD32H759IMK6使用定时器0的多模式通道进行输入捕获要怎么配置

    公司的项目是要使用到GD32H759IMK6中TIMER0的8个通道进行输入捕获100Khz的方波。根据官方例程普通通道CH0、CH1、CH2、CH3能够正常捕获到,但是在使用多模式通道MCH0、MCH1、MCH2、MCH3时无论怎么配置,进入输入捕获中断函数的频率并不是由外部输入决定的,而是随着TIMER0规定的计时周期变化而变化,请教各位大佬有没有相关配置资料,或者思路。目前的配置如下:复制voidtimer0_config(void){timer_ic_parameter_structtimer_icinitpara;timer_parameter_structtimer_initpara;rcu_periph_clock_enable(RCU_TIMER0);rcu_periph_clock_enable(RCU_SYSCFG);timer_deinit(TIMER0);/*TIMER0configuration*/timer_struct_para_init(&timer_initpara);timer_initpara.prescaler=299;timer_initpara.alignedmode=TIMER_COUNTER_EDGE;timer_initpara.counterdirection=TIMER_COUNTER_UP;timer_initpara.period=65535;timer_initpara.clockdivision=TIMER_CKDIV_DIV1;timer_initpara.repetitioncounter=0;timer_init(TIMER0,&timer_initpara);/*TIMER0configuration*//*TIMER0CH1inputcaptureconfiguration*/timer_channel_input_struct_para_init(&timer_icinitpara);timer_icinitpara.icpolarity=TIMER_IC_POLARITY_RISING;timer_icinitpara.icselection=TIMER_IC_SELECTION_DIRECTTI;timer_icinitpara.icprescaler=TIMER_IC_PSC_DIV1;timer_icinitpara.icfilter=0x0;timer_input_capture_config(TIMER0,TIMER_CH_0,&timer_icinitpara);timer_input_capture_config(TIMER0,TIMER_CH_1,&timer_icinitpara);timer_input_capture_config(TIMER0,TIMER_CH_2,&timer_icinitpara);timer_input_capture_config(TIMER0,TIMER_CH_3,&timer_icinitpara);timer_input_capture_config(TIMER0,TIMER_MCH_0,&timer_icinitpara);timer_input_capture_config(TIMER0,TIMER_MCH_1,&timer_icinitpara);timer_