cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F103ZE Timer1

avi2
Associate II
Posted on December 17, 2013 at 07:53

Hello,

I started a new design with the STM32F103ZE.

I am trying to activate TIM1 with no success.

I activated TIM4 and it works well.

I am using PortA PA9 & PA10 as USART_TX & RX , is there any conflict with PA8 & PA11 -TIM1_CH1 & TIM1_CH4  ?

Any suggestions ?

Thanks
3 REPLIES 3
chen
Associate II
Posted on December 17, 2013 at 11:26

Hi

You said you are trying to use timer 1. What are you trying to do with timer 1 (eg PWM)?

''I activated TIM4 and it works well.''

What was timer4 doing?

''is there any conflict with PA8 & PA11 -TIM1_CH1 & TIM1_CH4  ? ''

No. To use the timer output, you have to select alternate function for that port bit.

In addition, you have to select, enable and configure one of the timer 'OutputComp'

(see the block diagram)

Even though you are selecting Timer1, Timer1 can be used with 1 of 4 OCs

BUT each OC can only be used for a single timer (refered to as the 'Channel' in TIM1_CHx)

In addition, the outputs are tied to specific channels

PA8 can only output channel 1 linked to Timer1

PA11 can only output channel 4 linked to Timer 1

Do not forget that the port bit must be configured correctly.

(Long gone are the days when the DataSheets gave decent explanations, even in those days we still moaned how bad they were! LOL)

avi2
Associate II
Posted on December 17, 2013 at 14:38

Hi ,

Thanks for replying.

I am aware of how the Timers work.

I am using TIM4 as TIM_OCMode_PWM1.

I tried the same configuration for TIM1 as TIM_OCMode_PWM1 and it doesn't work.

I think I don't need to use it as AF , I tried it also .

chen
Associate II
Posted on December 17, 2013 at 15:10

Hi

As I said, the timers have a limited number of OC (OutputCompare/Control)

Make sure Timer1 is not using the same OC as timer 4.

Make sure the output port bit is configured to alternate function and select the correct

function.

(The data sheet says that USART1 can be output on PA8 and PA11 but different parts of the USART

PA8 is USART CK

PA11 is USART CTS

but you are looking for TIM1_CH1 or TIM1_CH4)