2009-09-15 05:41 AM
STM32 USART1 RTS not working?
2011-05-17 04:17 AM
Dear all,
I have a project using STM32F103CBT6. I have a problem with the USART1 HW flow control. When i set RTS mode the pin is never go low (indicate that it can accept data). If i set to none flow control it works well. I try to use the sample project (hyperterminal HW flow control), it works fine with USART2, but if i put the code to USART1 it's not. I really have to use USART1, just that modul support 3Mbaud. Is there any idea?2011-05-17 04:17 AM
Is the port pin for USART1's RTS line configured as
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP; Many people forget that outputs from peripherals don't connect to their associated port pin unless that pin is configured for one of the ''Alternate Function'' settings.2011-05-17 04:17 AM
Yes, the PIN is configured correctly.
Tha sam code (pin and usart name is changed) is working with USART2. The interesting thing is that i use USART2, after the PIO init the RTS goes LOW, when USART1 RTS goes high, this is before init of the USARTs2011-05-17 04:17 AM
Quote:
Yes, the PIN is configured correctly.
Have you also correctly configured the alternate function clock? And the pin re-mapping?2011-05-17 04:17 AM
I use PA12 as RTS, this is the default AF of this pin.
I don't do a pin remap. The AF clock is running.2011-05-17 04:17 AM
Not sure if you got resolution on this, but I've been seeing this exact same problem on an STM32R103RET6 part (Z Rev), and got here from Googling the issue.
Everything is enabled correctly, and in fact the RTS pin works with my attached wireless modem if I use the pin as a GPIO instead. If USART1 is in control, the RTS pin goes high by default, causing me problems. This looks like issue 2.41 in the errata http://www.st.com/stonline/products/literature/es/14574.pdf http://www.st.com/stonline/products/literature/es/14732.pdf I'm not using CAN, remapping the pin seemed to make things happier. /* Configure USART1 RTS (PA.12) as alternate function push-pull */ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_12; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; #ifdef USE_RTS GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP; // Driven by UART #else GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; // Drive as a GPIO #endif GPIO_Init(GPIOA, &GPIO_InitStructure); #ifdef USE_RTS /* Enable the CAN TX/RX Pins Software Remapping to get them off the PA.11 and PA.12 pins */ GPIO_PinRemapConfig(GPIO_Remap2_CAN, ENABLE); #endif -Clive[ This message was edited by: clive1 on 15-09-2009 18:18 ]