Question
STM8S UART TX Interrupt Problem
Hello to everyone, I am dealing with STM8S103F3P6 IC. I try to send a message using TX interrupt but I have never succeeded. I have checked the example of the UART interrupt. Also, tried to develop same code. However, I got still zero.
I took interrupt vector function from STM8 examples. Where is the my mistake? How can I figure out?
Here my init, main, and interrupt vector function;
void init_handler(void){
CLK_HSIPrescalerConfig(CLK_PRESCALER_HSIDIV1);
UART1_DeInit();
UART1_Init((uint32_t)9600, UART1_WORDLENGTH_8D, UART1_STOPBITS_1, UART1_PARITY_NO, UART1_SYNCMODE_CLOCK_DISABLE, UART1_MODE_TXRX_ENABLE);
UART1_ITConfig(UART1_IT_TXE,ENABLE);
enableInterrupts();
UART1_Cmd(ENABLE);
}main()
{
init_handler();
while(1);
}INTERRUPT_HANDLER(UART1_TX_IRQHandler, 17)
{
/* In order to detect unexpected events during development,
it is recommended to set a breakpoint on the following instruction.
*/
UART1_SendData8('a');
while (UART1_GetFlagStatus(UART1_FLAG_TXE) == RESET);
}