AnsweredAssumed Answered

STM32L15x: UART Configuration and use problem

Question asked by giampa_.valerio on May 14, 2012
Latest reply on Mar 1, 2016 by Clive One
hi everybody,
i have to cinfigure an uart interface of my stm32l152 on STM32l-discovery or STM32-sk evaluation board.
I have used to configure the uart peripheral interface the example in the stm32 library called HyperTerminal_Interrupt.
The uart peripheral configuration consist of these code lines:

USART_InitStructure.USART_BaudRate = 9600;
  USART_InitStructure.USART_WordLength = USART_WordLength_8b;
  USART_InitStructure.USART_StopBits = USART_StopBits_2;
  USART_InitStructure.USART_Parity = USART_Parity_Odd;
  USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
  USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;

  STM_EVAL_COMInit(COMX, &USART_InitStructure);

The STM_EVAL_COMInit is a function defined in the stm32l152d_eval.h or stm32l152_eval.h file.

Than I have modified the main to transmit continuousily the 0xAA byte with a pooling of the TC flag. The source code that I have included in the main file after at the uart configuration consist of:

    USART_SendData(USART3, 0xAA);
    while(USART_GetFlagStatus(USART3, USART_FLAG_TC) == RESET)
      USART_GetFlagStatus(USART3, USART_FLAG_TXE);

I don't see any data transmission on the tx pin of the uart peripheral. Also, I don't find any change in the Uart Data Register (in the register tab of the IAR EWARM).

Can sameone help me to configure the uart on the stm32l152?...I can use the STM32l-discovery or the STM32-SK evaluation board to test it.

Best Regards

Valerio Giampà