AnsweredAssumed Answered

TIM8 PWM Issue

Question asked by Pachchigar.Pinkesh on Mar 31, 2016
Latest reply on Apr 6, 2016 by Clive One
Hello ,
I have config to TIM8 to generate 12 MHz clock signal  on PC8 using Timer8 Channel . For this I have configured as per below . When I checked on DSO , I am not getting any signal . What could be the reason for this ?

int main(void)
{
             /* TIM Configuration */
            TIM_Config();
  /* TIM clock enable */
  RCC_APB2PeriphClockCmd(RCC_APB2Periph_TIM8, ENABLE);

  /* Time base configuration */
  TIM_TimeBaseStructure.TIM_Period = 6 ;       //for 2.048 MHz ---> use 40;
  TIM_TimeBaseStructure.TIM_Prescaler = 0;
  TIM_TimeBaseStructure.TIM_ClockDivision = 0;
  TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up;
  TIM_TimeBaseInit(TIM8, &TIM_TimeBaseStructure);

  /* PWM1 Mode configuration: Channel1 */
  TIM_OCInitStructure.TIM_OCMode = TIM_OCMode_Toggle;
  TIM_OCInitStructure.TIM_OutputState = TIM_OutputState_Enable;
  TIM_OCInitStructure.TIM_OCPolarity = TIM_OCPolarity_High;
  TIM_OC3Init(TIM8, &TIM_OCInitStructure);

  TIM_OC3PreloadConfig(TIM8, TIM_OCPreload_Enable);
  TIM_ARRPreloadConfig(TIM8, ENABLE);
  TIM_CtrlPWMOutputs(TIM8, ENABLE);

  /* TIM8 enable counter */
  TIM_Cmd(TIM8, ENABLE);

  while (1){}
}

void TIM_Config(void)
{
             GPIO_InitTypeDef GPIO_InitStructure;
  /* GPIOC and GPIOB clock enable */
  RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOC , ENABLE);
 
  /* GPIOC Configuration */
  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_8 ;
  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
  GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
  GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP ;
  GPIO_Init(GPIOC, &GPIO_InitStructure);

  /* Connect TIM8 pins to AF2 */  
  GPIO_PinAFConfig(GPIOC, GPIO_PinSource8, GPIO_AF_TIM8);
}

Outcomes