AnsweredAssumed Answered

STM32 clock Jitter on TIM4

Question asked by lavega.fernando on Apr 2, 2014
Latest reply on May 6, 2014 by Clive One
Hello everyone, I'm using STM32F100V8 and I configured TIM4 to generate a square wave (for uart sw). The TIM4 is so configured and should have the highest priority: 

  TIM_TimeBaseStructInit(&TIM_TimeBaseStructure); 
  TIM_TimeBaseStructure.TIM_Period = 1; 
  TIM_TimeBaseStructure.TIM_Prescaler = 405;
  TIM_TimeBaseStructure.TIM_ClockDivision = TIM_CKD_DIV1; 
  TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up; 
  TIM_TimeBaseInit(TIM4, &TIM_TimeBaseStructure);
  TIM_ITConfig(TIM4, TIM_IT_Update , ENABLE);

  NVIC_PriorityGroupConfig(NVIC_PriorityGroup_1);
  NVIC_InitStructure.NVIC_IRQChannel = TIM4_IRQChannel;
  NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
  NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
  NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
  NVIC_Init(&NVIC_InitStructure);  

Inside the ISR of TIM4 i toggle a MCU line and my scope show me that the clock has a very high jitter; Could someone give me some suggestion to make te clock more stable ?
 Here attached an image from my scope acquired on a long time with infinite persistence time 

Attachments

Outcomes