使用官方提供的SDK, GPIO,UART5,AFIO都使能了,GPIO_PinRemapConfig(GPIO_PartialRemap_USART5, ENABLE);也执行了
UART5的CTLR1 UE是1,AFIO的PCFR2 UART5_Remap为1,但是发送数据,连逻辑分析仪,都是E0
{ GPIO_InitTypeDef GPIO_InitStructure = {0}; USART_InitTypeDef USART_InitStructure = {0}; RCC_APB1PeriphClockCmd(RCC_APB1Periph_UART5 , ENABLE); RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB|RCC_APB2Periph_AFIO, ENABLE); /*uart5 TX-->B.4 RX --> B.5*/ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_4; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP; GPIO_Init(GPIOB, &GPIO_InitStructure); GPIO_InitStructure.GPIO_Pin = GPIO_Pin_5; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING; GPIO_Init(GPIOB, &GPIO_InitStructure); GPIO_PinRemapConfig(GPIO_PartialRemap_USART5, ENABLE); /*uart enable*/ USART_InitStructure.USART_BaudRate = 19200; 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_Tx | USART_Mode_Rx; USART_Init(UART5, &USART_InitStructure); USART_Cmd(UART5, ENABLE); }
UART5的使用还有什么特殊的地方?
热门产品 :
CH634: 4端口USB3.0 HUB控制器芯片