Question
USART1 simple use problem
Posted on June 29, 2012 at 10:24
Hello everybody, I begin with CortexM4 STM32F4 on a keil developpement board (MCBSTM32F400) I try to use USART1 in a very simple mode. I take a look to example and discuss forums. My config seems to be good but no signals come out of the board. If someone could help me, it would be very smart.
Here is the config of the USART I take:/* GPIOB,GPIOF Periph clock enable */ RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOB | RCC_AHB1Periph_GPIOF, ENABLE);/*USART1 Periph clock enable*/ RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1, ENABLE); /* Configure PB6 PB7 in alternate function */ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_6 | GPIO_Pin_7; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF; GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz; GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP; GPIO_Init(GPIOB, &GPIO_InitStructure);/* Connect USART pins to AF */ GPIO_PinAFConfig(GPIOB, GPIO_PinSource6, GPIO_AF_USART1); // USART1_TX GPIO_PinAFConfig(GPIOB, GPIO_PinSource7, GPIO_AF_USART1); // USART1_RX/*Configure USART1 parameters*/ 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(USART1,&USART_InitStructure); USART_Cmd(USART1,ENABLE);In th main program I just try to put 'I':while(USART_GetFlagStatus(USART1, USART_FLAG_TXE) == RESET); // Wait for EmptyUSART_SendData(USART1, 0x49); // Send 'I'Nothing happens, I don't understand #stm32f4-usart