Skip to main content
akramin
Visitor II
December 20, 2010
Question

STM32F103 Usart problem

  • December 20, 2010
  • 1 reply
  • 525 views
Posted on December 20, 2010 at 04:30

STM32F103 Usart problem

    This topic has been closed for replies.

    1 reply

    Tesla DeLorean
    Guru
    May 17, 2011
    Posted on May 17, 2011 at 14:18

    You need to ensure that the AFIO is clocked for remapping to work. If you are using a different crystal you'll need to ensure the system is clocking at the speed the library code expects it to.

    Try cleaning up the GPIO configuration

    void GPIO1_Configuration(void)

    {

      GPIO_InitTypeDef GPIO_InitStructure;

      /* Enable AFIO clock */

      RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO, ENABLE);

        /* Enable the USART2 Pins Software Remapping */

          GPIO_PinRemapConfig(GPIO_Remap_USART2, ENABLE);

          /* Configure USART2 Tx (PA.02) as alternate function push-pull */

          GPIO_InitStructure.GPIO_Pin = GPIO_Pin_2;

          GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;

        GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;

          GPIO_Init(GPIOA, &GPIO_InitStructure);               

          /* Configure USART2 Rx (PA.3) as input floating */

          GPIO_InitStructure.GPIO_Pin = GPIO_Pin_3;

          GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;

          GPIO_Init(GPIOA, &GPIO_InitStructure);

      }

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..