-
GD32A503 TIMER 上溢UP中断与CAP中断优先级有一定几率反转问题
测试硬件:GD32A503CC测试外设:TIMER0_CH1测试准备:PE5输入高频PWM中断优先级配置:UP中断高于CH1中断voidnvic_configuration(void){nvic_priority_group_set(NVIC_PRIGROUP_PRE1_SUB3);nvic_irq_enable(TIMER0_BRK_UP_TRG_CMT_IRQn,1,0);nvic_irq_enable(TIMER0_Channel_IRQn,1,1);}测试定时器配置:配置TIMER0_CH1为双沿输入捕获模式,使能TIMER0UP上溢与CH1中断。voidtimer_configuration(void){/*TIMER1configuration:inputcapturemode-------------------theexternalsignalisconnectedtoTIMER0CH1pin(PE5)therisingedgeisusedasactiveedgetheTIMER1CH0CVisusedtocomputethefrequencyvalue------------------------------------------------------------*/timer_ic_parameter_structtimer_icinitpara;timer_parameter_structtimer_initpara;rcu_periph_clock_enable(RCU_TIMER0);timer_deinit(TIMER0);/*TIMER0configuration*/timer_struct_para_init(&timer_initpara);timer_initpara.prescaler=99;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_BOTH_EDGE;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_1,&timer_icinitpara);/*auto-reloadpreloadenable*/timer_auto_reload_shadow_enable(TIMER0);/*clearchannel0interruptbit*/timer_interrupt_flag_clear(TIMER0,TIMER_INT_FLAG_UP
2024-06-18 11