2012-11-02 12:54 AM
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 ?2012-11-02 02:42 AM
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.2012-11-02 02:55 AM
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.2012-11-02 03:34 AM
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.2013-01-17 05:39 AM
Hi,
Sorry for this so late reply. As recommended by Clive1, the limitation is given in thehttp://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