问题:拟用TIM8的CCR4触发ADC3的两个通道注入转换,但是ADC3总是没有被触发,如果换成TIM1的CCR4就可以工作。我对TIM1与TIM8的配置是一样一样的。想不明白为什么不行,因为按着手册上来讲,这两种触发源对ADC3应该都是起作用的啊。下边为我的ADC3配置(时钟已在别处统一配置),请大家看看,是哪出了问题?
/*************************************************
* @functionname:AD_Init(void)
* @brief Configures AD of module
* @retval None
* @others
*************************************************/
void AD_Init(void)
{
ADC_InitTypeDef ADC_InitStructure;
NVIC_InitTypeDef NVIC_InitStructure;
ADC_InitStructure.ADC_Mode = ADC_Mode_InjecSimult;
ADC_InitStructure.ADC_ScanConvMode = ENABLE;
ADC_InitStructure.ADC_ContinuousConvMode=DISABLE;
ADC_InitStructure.ADC_ExternalTrigConv = ADC_ExternalTrigConv_None;
ADC_InitStructure.ADC_DataAlign = ADC_DataAlign_Right;
ADC_Init(ADC3, &ADC_InitStructure);
ADC_InjectedSequencerLengthConfig(ADC3, 2);//配置注入组总长度
ADC_InjectedChannelConfig(ADC3, ADC_Channel_2, 1, ADC_SampleTime_7Cycles5);
ADC_InjectedChannelConfig(ADC3, ADC_Channel_3, 2, ADC_SampleTime_7Cycles5);
ADC_ExternalTrigInjectedConvConfig(ADC3, ADC_ExternalTrigInjecConv_T8_CC4);
ADC_ExternalTrigInjectedConvCmd(ADC3,ENABLE);
ADC_ITConfig(ADC3, ADC_IT_JEOC, ENABLE);
ADC_SoftwareStartConvCmd(ADC3,ENABLE);
ADC_Cmd(ADC3,ENABLE);
ADC_ResetCalibration(ADC3);
while(ADC_GetResetCalibrationStatus(ADC3));
ADC_StartCalibration(ADC3);
while(ADC_GetCalibrationStatus(ADC3));//
NVIC_InitStructure.NVIC_IRQChannel = ADC3_IRQn;//ADC1_2_IRQn; //ADC1,ADC2全局中断
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0; //先占优先级0
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;//从优先级
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
ADC_Cmd(ADC3,DISABLE);
} |