cancel
Showing results for 
Search instead for 
Did you mean: 

USART3 Configuration - Help please

John F.
Senior
Posted on February 24, 2010 at 12:47

USART3 Configuration - Help please

#usart3
4 REPLIES 4
John F.
Senior
Posted on May 17, 2011 at 13:41

Thanks clive1. I now have Usart3 transmitting.

Posted on May 17, 2011 at 13:41

I have two projects using USART3, this one is on PC10 and PC11 on a STM32F103RET6, but might give you a starting point. I cut some of the flow-control stuff out.

-Clive

RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB | // USART3 Flow Control

                         RCC_APB2Periph_GPIOC | // USART3 Tx/Rx

                         RCC_APB2Periph_AFIO, ENABLE); // Alternate Function

  RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART3, ENABLE);

  /* Enable the USART3 Pins Software Remapping */

  GPIO_PinRemapConfig(GPIO_PartialRemap_USART3, ENABLE); // TX/PC10, RX/PC11, CK/PC12, CTS/PB13, RTS/PB14

  /* Configure USART3 Tx (PC.10) as alternate function push-pull */

  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10;

  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;

  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;

  GPIO_Init(GPIOC, &GPIO_InitStructure);

  /* Configure USART3 Rx (PC.11) as input floating */

  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_11;

  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;

  GPIO_Init(GPIOC, &GPIO_InitStructure);

  USART_InitStructure.USART_BaudRate            = 115200;

  USART_InitStructure.USART_WordLength          = USART_WordLength_8b;

  USART_InitStructure.USART_StopBits            = USART_StopBits_1;

  USART_InitStructure.USART_Parity              = USART_Parity_No ;

  USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;

  USART_InitStructure.USART_Mode                = USART_Mode_Rx | USART_Mode_Tx;

  USART_Init(USART3, &USART_InitStructure);

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
Posted on May 17, 2011 at 13:41

Ok, the other project uses PB10 and PB11, so yes they do work. I have them working with interrupts, and with/without Tx DMA.

Make sure that I2C2 isn't enabled.

What chip are you using, and what kind of problems are you seeing?

-Clive

  /* Configure USART3 Tx (PB.10) as alternate function push-pull */

  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10;

  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;

  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;

  GPIO_Init(GPIOB, &GPIO_InitStructure);

  /* Configure USART3 Rx (PB.11) as input floating */

  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_11;

  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;

  GPIO_Init(GPIOB, &GPIO_InitStructure);

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
John F.
Senior
Posted on May 17, 2011 at 13:41

OK. USARTs 1 2 and 3 working now, TX and RX. Thanks for your help getting me started.