cancel
Showing results for 
Search instead for 
Did you mean: 

It isn`t the output compare TIM1`s signal (stm32f103c8t6).

Andrew Androsow
Associate II
Posted on September 23, 2017 at 13:19

Hello! I try to program stm32f103c8t6 TIM1 in output compare mode (connecting it to  PA8 pin).But PA8 doesn`t have any signal.In  Keil`s debugger the timer running. 

&sharpinclude <stm32f10x.h>

void main(void)

{

RCC->APB2ENR |= RCC_APB2ENR_IOPAEN;

RCC->APB2ENR |= RCC_APB2ENR_IOPBEN;

RCC->APB2ENR |= RCC_APB2ENR_TIM1EN ;

GPIOB ->CRH = GPIO_CRH_CNF13_1 | GPIO_CRH_MODE13;

GPIOA->CRH = GPIO_CRH_CNF8_1 | GPIO_CRH_MODE8;

TIM1->CCMR1 = TIM_CCMR1_OC1PE|TIM_CCMR1_OC1M_0 |TIM_CCMR1_OC1M_1 ;

TIM1->CCER=TIM_CCER_CC1E;

TIM1->ARR = 0x0FFF;

TIM1->PSC = 0x000A;

TIM1->CCR3 = 0x0000;

TIM1->CR1 |= TIM_CR1_CEN|TIM_CR1_ARPE;

while(1)

{

}

}

 P.S.  Width TIM2 this code running well.

Thank for answer!

#stm32f103-tim1
1 ACCEPTED SOLUTION

Accepted Solutions
Andrew Androsow
Associate II
Posted on September 28, 2017 at 18:35

Thanks a lot for your help and answers!!! I didn`t write TIM_BDTR_MOE flag  into BDTR register

.

View solution in original post

3 REPLIES 3
Posted on September 24, 2017 at 09:55

Hello!

PA8 is not by defaul connected internaly to TIM1.

Alternate Function IO  functionality must used to assign PA8 as TIM1_OC.

AFIO registers described in RM.

Also in RCC_APB2ENR register the AFIO EN  bit must be set before configure AFIO registers.

Regards

vf

Posted on September 24, 2017 at 12:02

The advanced timers (TIM1 and TIM8) need also TIMx_BDTR.MOE to be set, for outputs to work.

JW

Andrew Androsow
Associate II
Posted on September 28, 2017 at 18:35

Thanks a lot for your help and answers!!! I didn`t write TIM_BDTR_MOE flag  into BDTR register

.