AnsweredAssumed Answered

stm32f0 discovery usart1 tx stays high

Question asked by reetz.tom on Oct 1, 2012
Latest reply on Oct 2, 2012 by reetz.tom
Hello,
I try to use the usart1 pa9 as tx and pa10 as rx with the following code
 /* Enable GPIO clock */
 RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOA, ENABLE);   //PA9 ,PA10
 /* Enable USART clock */
 RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1, ENABLE);
 /* Connect PXx to USARTx_Tx */
 GPIO_PinAFConfig(GPIOA, GPIO_PinSource9, GPIO_AF_0);     //PA9 -> TX
 /* Connect PXx to USARTx_Rx */
 GPIO_PinAFConfig(GPIOA, GPIO_PinSource10, GPIO_AF_0);    //PA10 -> RX
 /* Configure USART Tx as alternate function push-pull */
 GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9;
 GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
 GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
 GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
 GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
 GPIO_Init(GPIOA, &GPIO_InitStructure);
 /* Configure USART Rx as alternate function push-pull */
 GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10;
 GPIO_Init(GPIOA, &GPIO_InitStructure);
 /* USART configuration */
 USART_InitStructure.USART_BaudRate = 9600;
 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);
 /* Enable USART */
 USART_Cmd(USART1, ENABLE);

sending when KEY (Pa0) is pressed:
 USART_SendData(USART1, (uint8_t) 'F');
                  while (USART_GetFlagStatus(USART1, USART_FLAG_TXE) == RESET);
                  while (USART_GetFlagStatus(USART1, USART_FLAG_TC) == RESET);

All I get is a continuous high on the port, no reaction whatsoever.
TIA
tom

Outcomes