AnsweredAssumed Answered

PWM with TIM8 works only with debugger

Question asked by schmitt.frank on Jan 3, 2014
Latest reply on Jan 3, 2014 by schmitt.frank
Hello,
ich trying to create a PWM signal with TIM8 (channel 1). The PWM signal is generated
as expected but only if i run the debugger.
When i turn of the debugger the PWM signal is still running. When i turn off the power and restart the device without the debugger the PWM signal is not running.
 
Does anybody have an idea?

As i wrote, the PWM signal is running so i dont think there is a problem with the configuration:
    // RCC configuratin for TIM8 and GPIOC
    RCC_APB2PeriphClockCmd(RCC_APB2Periph_TIM8, ENABLE);
    RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOC | RCC_APB2Periph_AFIO, ENABLE);
  
    // Init structure
    GPIO_InitTypeDef GPIO_InitStructure;
  
    // GPIOC Configuration: TIM8 channel1
    GPIO_InitStructure.GPIO_Pin =  GPIO_Pin_6;
    GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
    GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
    GPIO_Init(GPIOC, &GPIO_InitStructure);
  
    // Init structures
    TIM_TimeBaseInitTypeDef  TIM_TimeBaseStructure;
    TIM_OCInitTypeDef  TIM_OCInitStructure;
  
    TIM_TimeBaseStructure.TIM_Period = 5000;
    TIM_TimeBaseStructure.TIM_Prescaler = 0;
    TIM_TimeBaseStructure.TIM_ClockDivision = 0;
    TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up;
    TIM_TimeBaseInit(TIM8, &TIM_TimeBaseStructure);
  
    TIM_OCInitStructure.TIM_OCMode = TIM_OCMode_PWM1;
    TIM_OCInitStructure.TIM_OutputState = TIM_OutputState_Enable;
    TIM_OCInitStructure.TIM_Pulse = 2500;
    TIM_OCInitStructure.TIM_OCPolarity = TIM_OCPolarity_High;
    TIM_OC1Init(TIM8, &TIM_OCInitStructure);
      
    TIM_OC1PreloadConfig(TIM8, TIM_OCPreload_Enable);
    TIM_ARRPreloadConfig(TIM8, ENABLE);
    TIM_CtrlPWMOutputs(TIM8, ENABLE);
    TIM_Cmd(TIM8, ENABLE);
}

The device is a STM32F103RCT7, the programmer is a j-Link (using SWD).
Compiler: IAR ANSI C/C++ Compiler V6.60.1.5097/W32 for ARM 

Outcomes