GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9
* Configure USARTy Tx as alternate function push-pull */ GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING
* Configure USARTy Rx as input floating */ RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1, ENABLE) RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA | RCC_APB2Periph_AFIO, ENABLE) RCC_AHBPeriphClockCmd(RCC_AHBPeriph_DMA1, ENABLE) While (DMA_GetFlagStatus(USARTy_Rx_DMA_FLAG) = RESET) * Wait until USARTy RX DMA1 Channel Transfer Complete */ While (DMA_GetFlagStatus(USARTy_Tx_DMA_FLAG) = RESET) * Wait until USARTy TX DMA1 Channel Transfer Complete */ USART_DMACmd(USART1, USART_DMAReq_Rx | USART_DMAReq_Tx, ENABLE) * Enable USARTy DMA Rx and TX request */ USART_Init(USART1, &USART_InitStructure) USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None USART_InitStructure.USART_Parity = USART_Parity_No USART_InitStructure.USART_StopBits = USART_StopBits_1 USART_InitStructure.USART_WordLength = USART_WordLength_8b USART_InitStructure.USART_BaudRate = 115200 Hardware flow control disabled (RTS and CTS signals) * USARTy and USARTz configured as follow: