2012-04-20 11:27 PM
Hi Everyone,
I have developed a program on STM3210E-Eval, in which I have configured both USART1 and USART2 to send data on their respective interrupts. Unfortunately only USART2 is sending data. UART1 is not sending the data. Attached file contains the relevant files. Kindly help. Bye, Nick.2012-04-21 05:28 AM
You want to initialize USART1, not USART2
ie USART_Init( USART2, &USART_InitStructure); // Configure the USART1 should be USART_Init( USART1, &USART_InitStructure); // Configure the USART1// Configure UART1
void UART1_Configuration(void)
{
// USART1 configured as follow:
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(USART2, &USART_InitStructure); // Configure the USART1
//Enable the USART Transmit interrupt: this interrupt is generated when the
//USART1 transmit data register is empty
USART_ITConfig(USART1, USART_IT_TXE, ENABLE);
//Enable the USART Receive interrupt: this interrupt is generated when the
//USART1 receive data register is not empty
USART_ITConfig(USART1, USART_IT_RXNE, ENABLE);
//Enable USART1
USART_Cmd(USART1, ENABLE);
}
2012-04-21 06:16 AM
Thanks Clive,