您好,我想用ch32v307的定时器同步功能来实现多个相位的信号。例如:
用TIM1 的OC3 启动TIM2, 用TIM2的OC3 启动TIM3。
然而实际实现里用逻辑分析仪测试,这个相位并不受OC3 的数值控制。请问正确的使用方法是什么?
TIM2 代码:
TIM_SelectInputTrigger(TIM2, TIM_TS_ITR0);
TIM_SelectSlaveMode(TIM2, TIM_SlaveMode_Trigger);
TIM1 代码:
TIM_OCInitStructure.TIM_OCMode = TIM_OCMode_PWM1;
TIM_OCInitStructure.TIM_OutputState = TIM_OutputState_Enable;
TIM_OCInitStructure.TIM_OCPolarity = TIM_OCPolarity_Low;
TIM_OCInitStructure.TIM_Pulse = 10; //输出相位不受这个值控制
TIM_OC3Init( TIM1, &TIM_OCInitStructure );
TIM_SelectMasterSlaveMode(TIM1,TIM_MasterSlaveMode_Enable);
TIM_SelectOutputTrigger(TIM1, TIM_TRGOSource_OC3Ref);
TIM_Cmd( TIM1, ENABLE );