How to initialize STM32L152 UART2 using ST library?
Hi,
I'm using the evaluation board STEVAL-IDS001V4M which has a STM32L152 mounted on.
I'm having some trouble on the initialization of the UART2 peripheral.
I'm using the ST library contained into the STSW-CONNECT009 packet.
To initialize the UART2, I'm doing the following steps:
>> RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOA); //activate clock on peripheral
>> USART_StructInit(&USART_InitStruct); //initialize parameters (parity, stop bit, bauderate....)
>> USART_Init(USART2, &USART_InitStruct); //initialize USART2 parameters
>> USART_Cmd(USART2, ENABLE); //enable usart2
Then I use the following function to send multiple times a character 'A' to my PC.
void USART_SendData(USART_TypeDef* USARTx, uint16_t Data)
{
/* Check the parameters */
assert_param(IS_USART_ALL_PERIPH(USARTx));
assert_param(IS_USART_DATA(Data));
/* Transmit Data */
USARTx->DR = (Data & (uint16_t)0x01FF);
}
But nothing arrives at my COM port!
What did I miss in the initialization?