Skip to main content
delerium
Associate
September 15, 2009
Question

STM32 USART1 RTS not working?

  • September 15, 2009
  • 6 replies
  • 1467 views
Posted on September 15, 2009 at 14:41

STM32 USART1 RTS not working?

    This topic has been closed for replies.

    6 replies

    delerium
    deleriumAuthor
    Associate
    May 17, 2011
    Posted on May 17, 2011 at 13:17

    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 USARTs

    swhite
    Associate III
    May 17, 2011
    Posted on May 17, 2011 at 13:17

    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.

    delerium
    deleriumAuthor
    Associate
    May 17, 2011
    Posted on May 17, 2011 at 13:17

    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?

    delerium
    deleriumAuthor
    Associate
    May 17, 2011
    Posted on May 17, 2011 at 13:17

    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.

    st3
    Associate III
    May 17, 2011
    Posted on May 17, 2011 at 13:17

    Quote:

    Yes, the PIN is configured correctly.

    Have you also correctly configured the alternate function clock?

    And the pin re-mapping?

    clive2
    Visitor II
    May 17, 2011
    Posted on May 17, 2011 at 13:17

    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 ]