2010-02-24 03:47 AM
USART3 Configuration - Help please
#usart32011-05-17 04:41 AM
Thanks clive1. I now have Usart3 transmitting.
2011-05-17 04:41 AM
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);2011-05-17 04:41 AM
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);2011-05-17 04:41 AM
OK. USARTs 1 2 and 3 working now, TX and RX. Thanks for your help getting me started.