为什么我设置了定时器2触发dma请求,但是却没有触发,我初始化tim2如下,请指点:void TIM2_Init(void)
{
TIM_TimeBaseInitTypeDef TIM_TimeBaseStructure;
//NVIC_InitTypeDef NVIC_InitStructure;
RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM2, ENABLE);
TIM_TimeBaseStructure.TIM_Period = 103*2 ; //设置自动装载寄存器
TIM_TimeBaseStructure.TIM_Prescaler = 35; //分频计数
TIM_TimeBaseStructure.TIM_ClockDivision = 0;
TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up; //选择向上计数
TIM_TimeBaseInit(TIM2, &TIM_TimeBaseStructure);
TIM_SetAutoreload(TIM2, 103*2);
TIM_DMACmd(TIM2 , TIM_DMA_Update, ENABLE);
TIM_Cmd(TIM2, ENABLE); |