cancel
Showing results for 
Search instead for 
Did you mean: 

stm8s-discuvery timer1 channel does not working while channel 2 3 do

Ocohe
Associate

the function where taken from st spl

main() ;

  TIM1_DeInit();

  GPIO_DeInit(GPIOC);

  GPIO_Init(GPIOC, GPIO_PIN_1, GPIO_MODE_OUT_PP_HIGH_FAST);

  //TIM1_TimeBaseInit(0, TIM1_COUNTERMODE_UP, 4095, 0);

  TIM1->CCER1 = 0x77 ;

  TIM1->CCER2 = 0x37 ;

  TIM1->CCMR1 = 0x70 ; 

  TIM1->CCMR2 = 0x70 ; 

  TIM1->CCMR3 = 0x70 ;

  TIM1->CCMR4 = 0x70 ;

  TIM1->RCR  = 0x00 ;

  TIM1->PSCRH = 0x00 ; 

  TIM1->PSCRL = 0x00 ; 

  TIM1->ARRH  = 0x0F ; 

  TIM1->ARRL  = 0x05 ;

  TIM1->CCR1H = 0x07 ; 

  TIM1->CCR1L = 0xFF ; 

  TIM1->CCR2H = 0x05 ; 

  TIM1->CCR2L = 0xFF ;

  TIM1->CCR3H = 0x03 ; 

  TIM1->CCR3L = 0xFF ; 

  TIM1->CCR4H = 0x03 ; 

  TIM1->CCR4L = 0xFF ;

  

  TIM1->BKR  = 0x80 ; 

  TIM1->DTR  = 0x00 ; 

  TIM1->OISR  = 0x5F ; 

  TIM1_CtrlPWMOutputs(ENABLE);

  

  TIM1->CR1 = 0x01 ;

0 REPLIES 0