STM32F4XX-UART-Port-Configure

关于STM32F4XX处理器 使用库函数配置 UART 端口说明

TX - Conigure

GPIO_TypeDefStructure.GPIO_Pin = GPIO_Pin_X;
GPIO_TypeDefStructure.GPIO_Mode = GPIO_Mode_AF;
GPIO_TypeDefStructure.GPIO_OType = GPIO_OType_PP;   
GPIO_TypeDefStructure.GPIO_PuPd = GPIO_PuPd_UP;     
GPIO_TypeDefStructure.GPIO_Speed = GPIO_Speed_100MHz;

GPIO_Init(GPIOC,&GPIO_TypeDefStructure);

RX - Conigure

GPIO_TypeDefStructure.GPIO_Pin = GPIO_Pin_7;
GPIO_TypeDefStructure.GPIO_Mode = GPIO_Mode_AF;
GPIO_TypeDefStructure.GPIO_PuPd = GPIO_PuPd_UP;
GPIO_Init(GPIOC,&GPIO_TypeDefStructure);

TX 与 RX Mode 必须为 复用模式 

 

你可能感兴趣的:(STM32单片机)