AnsweredAssumed Answered

external clock mode problem

Question asked by mahmoud boroumand on Oct 22, 2017
Latest reply on Oct 22, 2017 by Clive One

Hello.I use stm32f107vct6 and use this code for external mode for timer 3 


RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM3 ,ENABLE);
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA|RCC_APB2Periph_AFIO, ENABLE);

 

GPIO_InitTypeDef GPIO_InitStructure;
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_6;
GPIO_InitStructure.GPIO_Mode=GPIO_Mode_AF_PP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOA, &GPIO_InitStructure);

TIM_TimeBaseInitTypeDef TIM_TimeBaseStructure;
TIM_TimeBaseStructure.TIM_Period = 1;
TIM_TimeBaseStructure.TIM_Prescaler = 25;
TIM_TimeBaseStructure.TIM_ClockDivision = TIM_CKD_DIV1;
TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up;
TIM_TimeBaseInit(TIM3, &TIM_TimeBaseStructure);
TIM_SelectInputTrigger(TIM3, TIM_TS_TI1FP1);
TIM_TIxExternalClockConfig (TIM3, TIM_TS_TI1FP1, TIM_ICPolarity_Rising, 0) ;
TIM_SelectSlaveMode(TIM3, TIM_SlaveMode_External1);
TIM_ITConfig(TIM3, TIM_IT_Update, ENABLE);
NVIC_InitTypeDef NVIC_InitStructure;

/* Enable the TIM1 global Interrupt */
NVIC_InitStructure.NVIC_IRQChannel = TIM3_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 2;

NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
TIM_Cmd(TIM3,ENABLE);

 

It work correctly but now i want use stm32f103c8 and i use exactly this code but it's not work(change internal pulse ) .whats different between them?

how  can i fix this problem?

Outcomes