AnsweredAssumed Answered

STM32F334 HRTIM1 synchronisation

Question asked by andreev.alexey on Feb 9, 2016
Hi!
I tried to synchronize Master HR timer   from T1 TRGO. But cant get result.
void TIM_config(void)
{
     RCC_APB2PeriphClockCmd(RCC_APB2Periph_TIM1, ENABLE);
     
  TIM_TimeBaseStructInit(&TIM_TimeBaseStructure);
  TIM_OCStructInit(&TIM_OCInitStructure);
     
  /* Time base configuration for TIM8 and TIM1 */
  TIM_TimeBaseStructure.TIM_Period = 2000; //2 * PWM_PERIOD50;
  TIM_TimeBaseStructure.TIM_Prescaler = 0;
  TIM_TimeBaseStructure.TIM_ClockDivision = 0;
  TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_CenterAligned1; 
  TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up;
  TIM_TimeBaseInit(TIM1, &TIM_TimeBaseStructure);
  
  TIM_OCInitStructure.TIM_OCMode = TIM_OCMode_Asymmetric_PWM2; 
  TIM_OCInitStructure.TIM_OCMode = TIM_OCMode_PWM2;
  TIM_OCInitStructure.TIM_OutputState = TIM_OutputState_Enable;
  TIM_OCInitStructure.TIM_OCPolarity = TIM_OCPolarity_High;
  TIM_OCInitStructure.TIM_Pulse = 1000; 
  TIM_OC1Init(TIM1, &TIM_OCInitStructure);
     TIM_SelectOutputTrigger(TIM1,TIM_TRGOSource_Update); 
  TIM_SelectMasterSlaveMode(TIM1,TIM_MasterSlaveMode_Enable );
  TIM_Cmd(TIM1, ENABLE);
}

void HRTIM_synchro(void)
{ HRTIM_SynchroCfgTypeDef pSynchroCfg;
     pSynchroCfg.SyncInputSource=HRTIM_SYNCINPUTSOURCE_INTERNALEVENT;
     pSynchroCfg.SyncOutputPolarity=HRTIM_SYNCOUTPUTPOLARITY_NONE ;
     pSynchroCfg.SyncOutputSource=HRTIM_SYNCOUTPUTSOURCE_MASTER_START;
     HRTIM_SynchronizationConfig(HRTIM1,&pSynchroCfg);               
}

Can somebody help ?

Thank in advance


Outcomes