cancel
Showing results for 
Search instead for 
Did you mean: 

TIM1 clock and USART1 conflict

longchair
Associate III
Posted on November 02, 2012 at 08:54

Hello everyone.

I have an application where I need to use two channels of TIM1 in DMA mode, and also USART1 only in RX mode.

TIM1 two first channels use PA8/ PA9

USART1 RX is PA10.

The feature using TIM1 works well alone

The feature using USART1 works also well alone.

but when I wanna use both at same time, it seems that enabling the usart Clock will ''disable'' somehow my TIM1 feature.

Could anyone explain me why :

RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1, ENABLE);

Will break my TIM1 configuration ?

I guess that it's linked to the fact that PA10 can be Usart TX as well, but I am not using it for the USART. Is there anyway to fix this other than remaping any of these two functions ?

4 REPLIES 4
Posted on November 02, 2012 at 10:42

I guess it's conceivable they clash on the F1 series parts, the F2 and F4 series have a much better muxing fabric for the AF pin functions. Have you looked at the errata?

Generally, I'd expect you would enable the USART and only select RX mode.
Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
longchair
Associate III
Posted on November 02, 2012 at 10:55

Hi Clive,

Well, let me detail a little bit more  the way i use it, there might be something I am doing wrong.

I first configure my TIM1, and configure its OC1 & OC2,

the TIM1 clocks config is as follows :

 /* TIM1, GPIOA clock enable */

  RCC_APB2PeriphClockCmd(RCC_APB2Periph_TIM1 | RCC_APB2Periph_GPIOA , ENABLE);

 

  /* DMA clock enable */

  RCC_AHBPeriphClockCmd(RCC_AHBPeriph_DMA1, ENABLE);

then GPIO, DMA are configured .

Then I do my usart config :

/* Enable GPIO clock */

  RCC_APB2PeriphClockCmd(RXUSART_GPIO_CLK |  RXUSART_Invert_GPIO_CLK , ENABLE);

 

 /* Enable USART Clock */

 RCC_APB2PeriphClockCmd(RXUSART_CLK, ENABLE);

then USART / GPIO and NVIC config.

When I configure the RCC for the USART, I can understand that there is no way for the chip to know that only RX will be used, as the USART init which specifies it is done later.

is there an issue with my sequencing ?

I don't know what you mean by checking the errata, could you please be more specific ? 🙂

Lionel.

Posted on November 02, 2012 at 11:34

The errata document for the part often lists the things that don't work together, which you'd normally assume would.

Like CAN and USART flow control. I don't remember there being a problem with TIM1/USART1, but I don't have the time/resources to verify it right now.

Can you use different timer channels?

If it remains an issue, consider and F2 or F4 series part, where the AF pin control was a little more considered.
Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
Nickname12657_O
Associate III
Posted on January 17, 2013 at 14:39

Hi,

Sorry for this so late reply.

As recommended by Clive1, the limitation is given in the

http://www.st.com/internet/com/TECHNICAL_RESOURCES/TECHNICAL_LITERATURE/ERRATA_SHEET/CD00273032.pdf

.

Longchair, what you guessed is true: For F1 products, the USARTx_TX pins cannot be used to output another alternate function.

Cheers,

STOne-32